-
1. Re: Date Validation in JSF & Richfaces
dgmanu Jul 7, 2010 6:32 AM (in response to vijayrajan1980)if you dnt want to enable manual entry then you can disable it by attribute enableManualInput="false"
if you want the manual input then use datepattern attribute
datePattern="MMM dd yyyy, HH:mm" i.e. which ever pattern you want it.
and also write the f:validator to validate the date.
-
2. Re: Date Validation in JSF & Richfaces
vijayrajan1980 Jul 7, 2010 7:29 AM (in response to dgmanu)Thnx manu for ur reply
But i have already tried this
Currently it is required to enableManualInput, So i have to set it to true.
I m also using a date pattern "MM/dd/yyyy" & am also using a <f:validator> tag
But the problem is
Till the value reaches my validator class it is corrected to proper date
i.e. if i enter 05/05/2010sas my validator class recieves it as 05/05/2010
I tried to trace back that at which point this value is getting corrected but in vain
I also looked in DateTimeConverter class which gives a conversion error for
asf05/05/2010, 05/05/2010000 but works fine for 05/05/2010sas
I hope this would give u a clear idea of the problem i m facing ...
I just want JSF or richfaces to give a error in case of this scenario instead of correcting the date by itselft by trimming characters at end
-
3. Re: Date Validation in JSF & Richfaces
dgmanu Jul 8, 2010 12:32 AM (in response to vijayrajan1980)1 of 1 people found this helpfulyou set date pattern "MM/dd/yyyy" and you are trying to I/P 05/05/2010sas , and expecting err msg, whatever the string you enter it take maximum MM/dd/yyyy length i.e. 12, if any I/P exceed that , that will be automatically trimmed. so in your case you are getting valid data. so my advice is to restrict the max length of your I/P. in your case its 12, if you use date pattren MMM dd yyyy, HH:mm then its 18 etc. hope this will help you.
-
4. Re: Date Validation in JSF & Richfaces
vijayrajan1980 Jul 8, 2010 1:43 AM (in response to vijayrajan1980)I used this tag to restrict the length to 10 characters
< rich:calendar value="#{myBean.date}" datePattern="MM/dd/yyyy" enableManualInput="true" inputStyle="width:80px">
< f:attribute name="maxlength" value="10"/>
< /rich:calendar>