[
https://issues.apache.org/struts/browse/STR-1799?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
J Alex updated STR-1799:
------------------------
Priority: Major (was: Minor)
Description:
I want to confirm if there's a way to specify a mapping between the dispatch
methods and the validations declaratively.
Let me explain what i mean : The scenario is a single-page <form> with multiple
accordions , where we have a single Action class and a single form-bean to hold
all sections.
in struts-config, we specify :
<action path="/myPage"
type="com.abc.MyAction"
name="MyForm"
scope="session"
parameter="method"
input="formpage.jsp"
validate="true">
now, in the jsp we have multiple submit buttons for each accordion, and the
intent is to validate ONLY the fields in a particular accordion on it's
corresponding submit click.
The problem now is we've to explicitly invoke validate() explicitly from the
Action class, set the "page" parameter and tag each of the fields with a "page"
attribute.
myFormBean myForm = (myFormBean) form;
myForm.setPage(1);
ActionMessages errors = myForm.validate( mapping, request );
where myFormBean is of ValidatorActionForm type.
This redundantly validates all accordions upto the current one - while the
ideal way is to validate ONLY the current accordion -- and this will be
possible if we can somehow connect the dispatch keys to the validation.xml
field definitions.
was:
In discussion of this enhancement
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17306>.
it was suggested that someone write a HOWTO for using the
DispatchAction and Validator together.
I'll attach the HOWTO to this ticket.
> HOWTO for DispatchAction and Validator
> --------------------------------------
>
> Key: STR-1799
> URL: https://issues.apache.org/struts/browse/STR-1799
> Project: Struts 1
> Issue Type: Improvement
> Components: Core
> Affects Versions: Nightly Build
> Environment: Operating System: other
> Platform: Other
> Reporter: nick.afshartous
> Assignee: Struts Developers
> Fix For: 1.2 Family
>
> Attachments: dispatch-validator-src.zip, dispatch-validator.xml
>
>
> I want to confirm if there's a way to specify a mapping between the dispatch
> methods and the validations declaratively.
> Let me explain what i mean : The scenario is a single-page <form> with
> multiple accordions , where we have a single Action class and a single
> form-bean to hold all sections.
> in struts-config, we specify :
> <action path="/myPage"
> type="com.abc.MyAction"
> name="MyForm"
> scope="session"
> parameter="method"
> input="formpage.jsp"
> validate="true">
> now, in the jsp we have multiple submit buttons for each accordion, and the
> intent is to validate ONLY the fields in a particular accordion on it's
> corresponding submit click.
> The problem now is we've to explicitly invoke validate() explicitly from the
> Action class, set the "page" parameter and tag each of the fields with a
> "page" attribute.
> myFormBean myForm = (myFormBean) form;
> myForm.setPage(1);
> ActionMessages errors = myForm.validate( mapping, request );
> where myFormBean is of ValidatorActionForm type.
> This redundantly validates all accordions upto the current one - while the
> ideal way is to validate ONLY the current accordion -- and this will be
> possible if we can somehow connect the dispatch keys to the validation.xml
> field definitions.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.