commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Siggelkow <>
Subject [Validator] Indexed properties
Date Thu, 12 Aug 2004 16:23:17 GMT
I have been working with indexedListProperty in Struts 1.2 (using 
Validator 1.1.3, I believe). Suppose I have the following validation:

<field property="partNumber" indexedListProperty="orders"
    <arg position="0" key="prompt.partNumber"/>
    <arg position="1" key="${var:minlength}"

Now, when I validate the form, if the minlength validation fails on one 
of the indexed properties, then none of the rest of the partNumber 
fields are checked for minlength.

I am using Struts and I was trying to output the error message beside 
the property using html:messages -- the result is that the error message 
is only generated for the first property that fails.

For what its worth, I did hack a fix -- I changed the

ValidatorResults validate(Map params, Map actions) method in the Field 
class [org.apache.commons.validator.Field].

Basically where it had (on line 724):
                 if (!good) {
                     return allResults;

I made it ...
                 if (!good && numberOfFieldsToValidate <= 1) {
                     return allResults;

This worked -- in other words I get all the messages generated for each 
field if the field is indexed.

Any opinions on ramifications of making this change or other possible 
solutions? I have not messed at all with the client-side javascript so I 
am not sure what the behavior is like there.

Bill Siggelkow

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

View raw message