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=37578>.
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=37578

           Summary: new validate-method for custom validation
           Product: Struts
           Version: 1.2.8
          Platform: All
        OS/Version: other
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Standard Actions
        AssignedTo: dev@struts.apache.org
        ReportedBy: [EMAIL PROTECTED]


in my current project i have forms, which need multiple form-validation 
depending on the users input. since in the present implementation i can only 
validate the form with one validator-key i suggest to add a new actionform-
method which allows to run a validation with a given validator-key provided by 
the application. heres my implementation:
public class DynaValidatorWithFormKeyForm extends DynaValidatorForm {
...
    public ActionErrors validate(String validationKey, ActionMapping mapping, 
HttpServletRequest request) {
        if (log.isDebugEnabled())
            log.debug("executing validate()");

        final ServletContext application = getServlet().getServletContext();
        final ActionErrors errors = new ActionErrors();
        final Validator validator = Resources.initValidator(validationKey, 
this, application, request, errors, page);
        try {
            validatorResults = validator.validate();
        } catch (ValidatorException e) {
            log.error(e.getMessage(), e);
        }
        return errors;
    }

}

this allows me to run different validations on one form...

regards
  chris

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to