You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Doug Bryant <db...@scra.org> on 2003/06/04 17:34:34 UTC

validator: how to validate if either of two fields is present and valid

we have a form we are displaying to the user.  depending on the
permissions the user has, they are required to either fill out a
"requiredDeliveryDate" or "daysAro"

Depending on what permissions you have, you must fill out one or the
other and you must fill in either a date or an integer value depending
on the field.

We are currently using validator for the rest of the app (1.1 rc1).

How can we achive this validation using validator?  

Writing a custom validate method does not seem to be a good solution
because you can only validate one field at a time.

We thought about extending
org.apache.struts.validator.DynaValidatorForm, overriding the validate
method,  validating everything we can using validator and coding the
rest, but it seems far from ideal.

Does anyone have any suggestions or has anyone ever run across this type
of problems before.

Thanks for any suggestions.

Doug


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org