This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes question on datetime converter and validation of a datetime field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "question on datetime converter and validation of a datetime field" Watch "question on datetime converter and validation of a datetime field" New topic
Author

question on datetime converter and validation of a datetime field

Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 386

I have a datetime field defined in my JSP page as:



When I am validating this field and the page is redisplayed it shows the following after I entered the value 04/11/2010 in this field and clicked SUBMIT again:

{0}: Conversion error occurred.

My validation code is as follows for this field:



Can someone please tell me what I'm doing wrong here? Any help/direction would be appreciated.

Thanks.

Abzee AntiPro
Greenhorn

Joined: Aug 23, 2010
Posts: 14

Hey, try using "dd/MM/yyyy".
java is case sensitive and sometimes causes issue with case.

also, why do you want the user to input dates manually.
give a small calendar next to the input box and let the user click and decide the date from the pop-up-calendar.

dont make the input text editable so you dont have to write a converter for it.

Regards,

Back to the Basics. Thats the only solution.
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 386

Thanks Abid for the quick reply. Can you give me any direction on what calendar I can use here?

Thanks again.
Abzee AntiPro
Greenhorn

Joined: Aug 23, 2010
Posts: 14

There are hundreds of script written for using a pop-up calendar.

here is one such site.

http://www.softcomplex.com/products/tigra_calendar/

i m attaching the script for your reference.

Thanks,
Abid

PS: open the attachment in a zip file.
It looks like a image file but its a zip archive


[tigra_calendar.jpg]

Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 386

Thank you so much. Appreciate all the help.
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 386

After finally getting the JS calendar setup on my form I selected a date from the calendar and then I got this error on my page:


Conversion Error setting value '08/23/2010' for 'null Converter'.


I may have misunderstood the post above but I thought I would not have to write a converter for this.

I then tried changing up my code in the JSP page to include the converter dateTime as follows:



And now I get this error in my web page:


ARTransferForm:fromServiceDate: '08/23/2010' could not be understood as a date.


Thanks again in advance for the help or direction on my problem. Regards.
Melinda Savoy
Ranch Hand

Joined: Jun 21, 2005
Posts: 386

Sorry I got my problem resolved. It was the pattern I had defined.

Thanks anyway. Regards.
Abzee AntiPro
Greenhorn

Joined: Aug 23, 2010
Posts: 14

thanks to you as well
 
jQuery in Action, 2nd edition
 
subject: question on datetime converter and validation of a datetime field
 
Similar Threads
Help - question on passing field ID to javascript function using onblur
using convertor in jsf
message required
JSF Validatuion to acquire only numeric values for an input field
Question on textfield next to DATEPICKER icon