Hi All,

I've been knocking my head on the problem for the past day and need
help. Nothing in the archives of FAQ's since most people seem to
be able to get the validations to work fine.

Problem: I cannot get the 'range' validator action to function. I can
get 'required' to function as expected so I know that the validation setup
is (mostly) correct. Strangely, the example struts-validation.war functions
correctly.

I see from the log that the validation rules are correctly being loaded and
also that the Validator Action for required has been registered. I've
included the relevant snips from the code below.

Interestingly, the
'required' validator action in the sequence "required,integer,range" does
fire, but neither of the others do when given obviously wrong input such as
'string' and '57'.

I am using Struts modules in this scenario but don't think that it is
relevant
since the 'required' validator actions are functioning correctly.

I am using Struts 1.1b2 under Tomcat 4.1.12, JDK1.4 and Windows 2000.

Any help deeply appreciated
-- Marcus

---8<--- struts-config-apply.xml
<form-bean name="applyPersonalDetailsForm"
type="org.apache.struts.validator.DynaValidatorForm">
...
<form-property name="dateOfBirthDay" type="java.lang.String" />
<form-property name="dateOfBirthMonth" type="java.lang.String" />
<form-property name="dateOfBirthYear" type="java.lang.String" />
...
<message-resources parameter="ApplicationResources_apply" null="false" />
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
   <set-property property="pathnames" value="/WEB-INF/validation_apply.xml,
/WEB-INF/validator-rules.xml" />
</plug-in>

---8<--- ApplicationResources_apply.properties
errors.required={0} is required.<br/>
errors.integer={0} must be an integer.<br/>
errors.range={0} is not in the range {1} through {2}.<br/>
prompt.apply.dateOfBirthDay=Date of birth
...

---8<--- validation_apply.xml
<form name="applyPersonalDetailsForm">
...
<field property="dateOfBirthDay" depends="required,integer,range">
<arg0 key="prompt.apply.dateOfBirthDay"/>
<arg1 name="range" key="${var:min}" resource="false"/>
<arg2 name="range" key="${var:max}" resource="false"/>
<var>
<var-name>min</var-name>
<var-value>1</var-value>
</var>
<var>
<var-name>max</var-name>
<var-value>31</var-value>
</var>
</field>
...
---8<--- applicationform.jsp
...
<html:errors/>
...
---8<---



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

Reply via email to