Let's say I have two validations:
<field
property="gender"
depends="required">
<arg0 key="subscriberForm.gender.label"/>
</field>
<field
property="dateOfBirth"
depends="required,date">
<arg0 key="subscriberForm.dateOfBirth.label"/>
</field>
Now, on the form, I leave gender blank and put garbage in for dateOfBirth.
When the form validates, gender is given an error because it is blank, and
dateOfBirth is not flagged at all.
Why?
Because in org.apache.commons.validator.Validator.validate(), hActionsRun
is defined outside of the main loop. This
means that if any field fails the "required" test, dateOfBirth will never
run the "date" check because the required
dependency fails, even though it's for another field.
If you then put an entry in gender, required passes, and on the next form
submission, you finally get your error for dateOfBirth.
If hActionsRun were moved inside the loop, it would work
correctly. However, it would mean that one field couldn't have a
dependency that was
defined by another, which I think is OK, since that's not supposed to be
kosher as far as I can tell. Should I submit that as a patch against commons?
James
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>