You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/10/10 16:03:39 UTC
DO NOT REPLY [Bug 31618] New: -
distinguish between "no validation errors" found and "not validated"
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31618>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=31618
distinguish between "no validation errors" found and "not validated"
Summary: distinguish between "no validation errors" found and
"not validated"
Product: Commons
Version: unspecified
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Validator
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: hauser@acm.org
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.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org