Re: [s2] Date format in TextField

2008-02-26 Thread Jeromy Evans

Petzsch, Martin wrote:


How is it possible to enforce that the textfield should show the date as
dd/mm/?

  


See this page:
http://struts.apache.org/2.x/docs/formatting-dates-and-numbers.html

It also applies to 2.0.x

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [s2] Date format in TextField

2008-02-26 Thread Petzsch, Martin

Many thanks for your response.

To clarify, our exact problem is as follows.  We have multiple fields where
we are displaying a date in an editable textfield, this date has come from
some service, not necessarily from a db.  When the date comes up from the
service layer it is the correct date; e.g. 01/01/2099.  However, when this
is displayed on the screen in a textfield it is displayed as 01/01/99.  This
causes a problem from a usability point of view, as it could be 2099 or 1999
or even , but the user will never know.  In addition when the form is
submitted and it is bound into the date field on the action/in the bean it
may not be reinterpreted as it should be.  For example the date 01/01/2099
is displayed as 01/01/99.  When the page is submitted, the date is
reinterpreted into the field as 01/01/1999 and the correct century is lost.

How is it possible to enforce that the textfield should show the date as
dd/mm/?

Many thanks,
Martin

-Original Message-
From: Richard Sayre [mailto:[EMAIL PROTECTED] 
Sent: 26 February 2008 17:59
To: Struts Users Mailing List
Subject: Re: [s2] Date format in TextField

I'm not sure if I understand you correctly but...

>  I want to display editable dates in textfields.

This should be as simple as using a textfield (input type=text) as
your date field


>I cannot use JavaScript, so
>  datetimepicker isn't an option.

So the user will have to manually enter the date by typing.

>Currently the date is displayed as dd/mm/yy
>  if there is a value.  How can I change this to be dd/mm/?

We recently has this probem.  We gave the user to an option set the
date format for our whole system.  Now whenver we read dates out of
the database they get formatted to the users specified format.

If you are using one date, then you can hard code the format (in a
properties file) and apply it to all dates that come out of the
database.  I believe in Oracle, and possibly other DBMS you can also
specify a format that you want the date to come out as when it is
queried.  You wont have to apply any formatting if this is the case.

For validation If you can't use java script the best way I can see to
do this would be to have your field:

MyDate: __  (dd/mm/)

This will inform the user of the correct format.  You will have to
validate this format on the server side and if the format is not
dd/mm/ you can return the error and let the user know tha the
format is wrong.



>
>
>
>  Many thanks,
>
>  Martin
>
>
>
>  Capgemini is a trading name used by the Capgemini Group of companies
which includes Capgemini UK plc, a company registered in England and Wales
(number 943935) whose registered office is at No. 1 Forge End, Woking,
Surrey, GU21 6DB.
>
>
>
>  This message contains information that may be privileged or confidential
and is the property of the Capgemini Group. It is intended only for the
person to whom it is addressed. If you are not the intended recipient,  you
are not authorized to read, print, retain, copy, disseminate,  distribute,
or use this message or any part thereof. If you receive this  message in
error, please notify the sender immediately and delete all  copies of this
message.
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Capgemini is a trading name used by the Capgemini Group of companies which 
includes Capgemini UK plc, a company registered in England and Wales (number 
943935) whose registered office is at No. 1 Forge End, Woking, Surrey, GU21 
6DB. 


This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [s2] Date format in TextField

2008-02-26 Thread Richard Sayre
I'm not sure if I understand you correctly but...

>  I want to display editable dates in textfields.

This should be as simple as using a textfield (input type=text) as
your date field


>I cannot use JavaScript, so
>  datetimepicker isn't an option.

So the user will have to manually enter the date by typing.

>Currently the date is displayed as dd/mm/yy
>  if there is a value.  How can I change this to be dd/mm/?

We recently has this probem.  We gave the user to an option set the
date format for our whole system.  Now whenver we read dates out of
the database they get formatted to the users specified format.

If you are using one date, then you can hard code the format (in a
properties file) and apply it to all dates that come out of the
database.  I believe in Oracle, and possibly other DBMS you can also
specify a format that you want the date to come out as when it is
queried.  You wont have to apply any formatting if this is the case.

For validation If you can't use java script the best way I can see to
do this would be to have your field:

MyDate: __  (dd/mm/)

This will inform the user of the correct format.  You will have to
validate this format on the server side and if the format is not
dd/mm/ you can return the error and let the user know tha the
format is wrong.



>
>
>
>  Many thanks,
>
>  Martin
>
>
>
>  Capgemini is a trading name used by the Capgemini Group of companies which 
> includes Capgemini UK plc, a company registered in England and Wales (number 
> 943935) whose registered office is at No. 1 Forge End, Woking, Surrey, GU21 
> 6DB.
>
>
>
>  This message contains information that may be privileged or confidential and 
> is the property of the Capgemini Group. It is intended only for the person to 
> whom it is addressed. If you are not the intended recipient,  you are not 
> authorized to read, print, retain, copy, disseminate,  distribute, or use 
> this message or any part thereof. If you receive this  message in error, 
> please notify the sender immediately and delete all  copies of this message.
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[s2] Date format in TextField

2008-02-26 Thread Petzsch, Martin

Hi,

 

I want to display editable dates in textfields.  I cannot use JavaScript, so
datetimepicker isn't an option.  Currently the date is displayed as dd/mm/yy
if there is a value.  How can I change this to be dd/mm/?

 

Many thanks,

Martin



Capgemini is a trading name used by the Capgemini Group of companies which 
includes Capgemini UK plc, a company registered in England and Wales (number 
943935) whose registered office is at No. 1 Forge End, Woking, Surrey, GU21 
6DB. 



This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is intended only for the person to whom 
it is addressed. If you are not the intended recipient,  you are not authorized 
to read, print, retain, copy, disseminate,  distribute, or use this message or 
any part thereof. If you receive this  message in error, please notify the 
sender immediately and delete all  copies of this message.