Has anybody gotten the Struts ValidatorActionForm to work?
I have two actions that use the same form and each action uses different elements of the form. From what I understand the ValidatorActionForm should take care of this by allowing me to map the action name to the validation process instead of the form name.
Here is what I have done:
1) Make my Form a sub class of the ValidatorAction Form;
public class SearchForm extends ValidatorActionForm {
2) Declare my action in the struts-config.xml:
<action path="/search"
type="org.apache.struts.actions.ForwardAction"
name="searchForm"
scope="request"
input=""
validate="true"
parameter="/ui/Search.jsp>
</action>
3) Specify the action as the form name to be validated.
<form name="/search">
<field property="filedDateFrom"
depends="date,mask">
<arg0 key="label.fromDate"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9]*$</var-value>
</var>
</field>
</form>
I have no validation method in the form and I have tried many combinations for the form name action "search", "/search.action", "search.action" and so forth.
What happens is it skips the validation. If I put the form name in there it works fine.
Any ideas?
Thank You in advance
Jeff Sulman
I have two actions that use the same form and each action uses different elements of the form. From what I understand the ValidatorActionForm should take care of this by allowing me to map the action name to the validation process instead of the form name.
Here is what I have done:
1) Make my Form a sub class of the ValidatorAction Form;
public class SearchForm extends ValidatorActionForm {
2) Declare my action in the struts-config.xml:
<action path="/search"
type="org.apache.struts.actions.ForwardAction"
name="searchForm"
scope="request"
input=""
validate="true"
parameter="/ui/Search.jsp>
</action>
3) Specify the action as the form name to be validated.
<form name="/search">
<field property="filedDateFrom"
depends="date,mask">
<arg0 key="label.fromDate"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9]*$</var-value>
</var>
</field>
</form>
I have no validation method in the form and I have tried many combinations for the form name action "search", "/search.action", "search.action" and so forth.
What happens is it skips the validation. If I put the form name in there it works fine.
Any ideas?
Thank You in advance
Jeff Sulman