Hi,
what exact value did you enter with the date pattern MM/dd/yy?
 
I dont like datePatternStrict because you have to enter the leading zero for dd 
and MM; and the year should format according to java.text.SimpleDateFormat 
rules.
 
I use dd/MM/yyyy (not strict) and the user can type the full year. I usually 
accompany "date" with my own custom date validators to ensure the date entered 
is in a valid range (eg >= today, between today-80 and today+20)
 
While day and month are always meaningful, year could be almost anything...if 
user types "2" should that be 1902, 2002 or even 2012 or 1992 ?
 
Although you could write a custom validator and try to handle 2 /4 digit years 
- you still have to work out the "real" year; which is a combination of 
1. what year did the user intend?
2. what year does my application expect/want?
 
Solution
1. use the yyyy pattern
2. use extra validation
 
Good Luck

________________________________

From: vacak [mailto:[EMAIL PROTECTED]
Sent: Wed 22/11/2006 9:40 PM
To: user@struts.apache.org
Subject: Date validation




  Hi,

  I use Validator 1.0 and I would like to validate date fields with the
format MM/dd/yy but it works only with the format: MM/dd/yyyy.
In the validation.xml i use this:

  <formset>
         <form name="entryPageForm">
            <field property="reqinitialdate"
                depends="date">
                <arg0 key="entryPageForm.reqinitialdate.displayname"/>
                <var>
                    <var-name>datePatternStrict</var-name>
                    <var-value>MM/dd/yy</var-value>
                </var>
            </field>

So i changed the <var-value> to the format i need but it still doesn't work.
What could be the problem? And what shall i do if i want to accept the both
format? (MM/dd/yy and MM/dd/yyyy)

Thanks

--
View this message in context: 
http://www.nabble.com/Date-validation-tf2684724.html#a7488591
Sent from the Struts - User mailing list archive at Nabble.com.


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



**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************

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

Reply via email to