struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Turner <>
Subject Weirdness/possible bug in Validator dependencies
Date Fri, 12 Jul 2002 22:18:03 GMT
Let's say I have two validations:
      <arg0 key="subscriberForm.gender.label"/>
      <arg0 key="subscriberForm.dateOfBirth.label"/>

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.


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?


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message