[
https://issues.apache.org/struts/browse/STR-3049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_41187
]
J Alex commented on STR-3049:
-----------------------------
Niall, thanks for your comment. What do you think is the best possible
workaround for this scenario ? . Is it possible to set validate=true and still
achieve section-wise validation , without explicitly invoking it from the
Action.
> Specifying Dispatcher based validations in validation.xml
> ---------------------------------------------------------
>
> Key: STR-3049
> URL: https://issues.apache.org/struts/browse/STR-3049
> Project: Struts 1
> Issue Type: Improvement
> Components: Core
> Environment: N/A
> Reporter: J Alex
>
> I want to confirm if there's a way to specify a mapping between the dispatch
> methods and the validations declaratively.
> The method should be independent of javascript.
> Scenario :
> Consider a single-page form (i.e single HTML <form> mapping to say
> /myAction.do ) with many sections, each section having its own Submit button.
> On submit of each, ONLY the fields within that section must be validated.
> Using DispatchAction to handle each submit button takes care of centralizing
> the handler methods and making the Action classes crisp. But, when it comes
> to validation, there's no way to specify in validation.xml the fields tied to
> a specific dispatch method.
> We could use the "page" parameter to delimit the validations, but this cannot
> be done declaratively since we cannot dynamically change the "page" using
> javascript on a particular submit. The workaround is to set validate=false,
> and explicitly invoke validation from the Action class after setting the
> "page" within each dispatcher method.
> i.e
> myForm.setPage(1);
> I think it will be a good enhancement to provide this mapping within Struts
> itself which i feel will greatly enhance the utility of DispatchAction.
> ActionMessages errors = myForm.validate( mapping, request );
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.