This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Struts and the fly likes Required field usage Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Required field usage" Watch "Required field usage" New topic
Author

Required field usage

Shaan patil
Ranch Hand

Joined: Dec 22, 2007
Posts: 58
Hi,

I want to know will this work when I dont input any value in the birthDate text box of the form ?

Specifically what I want to know is will this be validated incase I dont input anything in birthdate field ?

<field property="birthDate"
depends="date">
<arg0 key="inputForm.birthDate" />
<var>
<var-name>datePattern</var-name>
<var-value>MM-dd-yyyy</var-value>
</var>
</field>


"You cannot change the truth but truth can change you "
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
With your definition, any empty field will not generate any validation messages. If you need the field to be filled in, change your depends value to "required,date".

- Brent
Srilakshmi Vara
Ranch Hand

Joined: Jul 21, 2004
Posts: 169
depends="date" this is just date validation.
required is the not null validation.

You need to add two validations for the Birthday field

1. Not null Check.
2. If not null then check for valid date.

depends = "required,date" address your issue
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Required field usage
 
Similar Threads
why no errors shown for password validation in struts 1.2.4
doubt in using validwhen
validator requiredIf checking two conds
Validator for NOT NULL/ blanks
Using masks in Validations