struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dimitri Valdin" <>
Subject Re: Behavior of Validator
Date Thu, 18 Jul 2002 11:33:49 GMT

>Unfortunately, the way it works right now is that:
>1) date implies required in validator-rules.xml, which means that all
>dates are required.  You can only make a date (or float, or any other
>type-validated field) optional by removing the "required" from

I would also prefer not to have this dependency in validation-rules.xml
The nice point is that you can easily remove it by yourself.

>2) If you remove the required dependency from validator-rules, it still
>doesn't work right, because if you put a non-date in dateOfBirth and
>leave lastName empty, only lastName will generate an error, because
>the way Validator is written right now, if any dependency flags an error
>(even in another field), it stops validation beyond that dependency in
>all fields.

That's true, and it could be easily fixed. Nevertheless I would see several
options and decide a programmer/end customer how the errors should
be handled. I see no harm if at first will be checked, that all MUST fields
must be filled and then start to validate this fields. Of course it is possible
to check all fields at once. I would prefer to have yet another possiblility -
bring an error "please fill all required fields" if some of them is empty
and then start with the second check. It looks pretty ugly if you see
field 1 is required
field 2 is required
field N is required

Normally all required fields are marked with asterisk or with some other
sign, so user will automatically get feedback which fields are required.
Perhaps we can extend struts library for this purpose.

Another useful extention from my point of view would be to mark bad fields,
with red "!" or in some other way, so the error shown at the top of the page
could be easily "attached" to the input field(s).

Dmitri Valdin


Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie
nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren
Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie
die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender immediately and
destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.

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

View raw message