Meaningless Drivel is fun!
The moose likes Struts and the fly likes Required field usage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Required field usage" Watch "Required field usage" New topic

Required field usage

Shaan patil
Ranch Hand

Joined: Dec 22, 2007
Posts: 58

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"
<arg0 key="inputForm.birthDate" />

"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:
subject: Required field usage
It's not a secret anymore!