cancel
Showing results for 
Search instead for 
Did you mean: 

How check an inputField value ?

Former Member
0 Kudos

<b><i>Hi experts</i></b>,

How do you do when you want to check a value in a inputfield with type="date" ? My problem is that the field date is obligatory. When the inputfield is post with the form, this one is not null and not empty but equal to "0000-00-00" which correspond to "Sun Nov 30 00:00:00 CET 0002" in a Date type ! So how can I verify that my date field had not been set ?

<b><i>Best regards</i></b>.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Maybe use apache commons GenericValidator or regular expressions form the java.util.regex package.

Regards

Oliver

Former Member
0 Kudos

Hi,

You can do one thing. You can write a javascript function to check the value of the field and then submit the form. This way you can check whether it is blank or not.

Hope this helps.

Ranjith

daniel_davinci
Active Contributor
0 Kudos

If you don’t want to use javascript I always write a generic validate method (returning Boolean) called with a hashtable of fields to check. For JSP you can call this method in doProcessBeforeOutput or “onSubmit” (or any event that involves a round trip) if the fields don't have the correct values return a false and in your main method decide whether to proceed with processing the form or set the field to invalid and the state of the form back to edit mode for the user to correct the field value.

Regards

Daniel