commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (VALIDATOR-155) [validator] Distinguish between "no validation errors" found and "not validated"
Date Thu, 23 Nov 2006 00:29:03 GMT
     [ http://issues.apache.org/jira/browse/VALIDATOR-155?page=all ]

Niall Pemberton resolved VALIDATOR-155.
---------------------------------------

    Resolution: Won't Fix

You can get the number of fields validated from the ValidatorResults returned by the Validator's
validate() method. It provides a Set of all the names of the fields validated (see the ValidatorResults's
getPropertyNames() method).

Validator can be configured to either just return "errors" in the ValidatorResults or return
the results of all validations - the default behaviour is to return all results - but can
be configured using the Validator's setOnlyReturnErrors() method.

Closing this as WONT FIX

> [validator] Distinguish between "no validation errors" found and "not validated"
> --------------------------------------------------------------------------------
>
>                 Key: VALIDATOR-155
>                 URL: http://issues.apache.org/jira/browse/VALIDATOR-155
>             Project: Commons Validator
>          Issue Type: Improvement
>          Components: Framework
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Ralf Hauser
>            Priority: Minor
>
> My form validates no matter how much many field rules the values violate.
> By debugging, I noticed that the form was not found in ValidatorResources.getForm(
>             String language,
>             String country,
>             String variant,
>             String formKey).
> The formName as per Validator.formName appears to be "attribute, {1}" while the
> formKey String probably rather should be "myFormName".
> At least in the ValidatorResources.hFormSets, the form is properly listed under
> "myFormName" in position 1 (starting at 0).
> Probably, the translation of "attribute, {1}" to "myFormName" that can be
> understood by this.forms.get(formName) in FormSet.getForm(String formName)
> appears to be lost.
> Basic Suggestion: fix it.
> But even more, provide a way to distinguish in
> org.apache.struts.validator.ValidatorForm.validate(ActionMapping mapping,
>                                  HttpServletRequest request)
> whether any fields have been validated at all.
> One idea is to amend ValidatorResources.java with
> public int numbOfFieldsValidated = 0;
> and have org.apache.commons.validator.Form.validate(Map params, Map actions, int
> page) increment that value
>         while (fields.hasNext()) {
>             Field field = (Field) fields.next();
>             results.numbOfFieldsValidated++; //NEW !!!
>             params.put(Validator.FIELD_PARAM, field);
> P.S.: I am using the commons-validator1.1.3 jar and struts1.2 jar.
> As a side note, I subclass one form to another, but this may be well unrelated.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Mime
View raw message