struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Jensen <>
Subject Perform date validation only if field required (requiredIf/validWhen)
Date Fri, 20 Feb 2004 21:39:49 GMT


I have three radio buttons in a form,

o Today
o Tomorrow
o From this date: [ ____ ] 

I am currently using requiredIf and date validation on the date textarea .  The date entry
is only required if the correct radio button is selected and the date validation makes sure
this is in the right format.  

This works fine, until the user enters an invalid date that doesn't pass date validation and
*then* select's one of the other radio buttons, and submits.  The requiredIf passes fine (not
required), but the date validation is still perfomed and returns the page to the user.

Is it possible to perform date validation only if requiredif decides the fields are required?
 That is, don't test things that aren't required, without:
  * extra javascript in the page
  * without using custom validation java-code (the rest of the form's validation works great)

I have looked at validWhen (and am not aversed to going to the nightly-build), but can't see
the solution there either.

Any help would be appreciated,


View raw message