Have you tried removed the  depends="required" from alidation-rules.xml?

-Devin


-----Original Message-----
From: Axel Stahlhut [mailto:[EMAIL PROTECTED]]
Sent: Sunday, September 01, 2002 7:13 AM
To: 'Struts Users Mailing List'
Subject: Problems using the date-Validator with non required attributes


With the Struts-Validator Framework i want to validate a Date. 
This works fine, but if the field i want to validate is not a required field and may 
be empty, the validator always reports an error, even if if i remove the 
depends="required". 
Do i have to implement the Validator-class in a way that it doesnt validate empty 
dates or is there any declarative way to solve this?
Thanks for any help.

Axel

This is my validation-rules.xml:

      <validator name="date"
            classname="org.apache.struts.util.StrutsValidator"
               method="validateDate"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionErrors,
                       javax.servlet.http.HttpServletRequest"
              depends="required"
                  msg="errors.date"
       jsFunctionName="DateValidations">

and the validation.xml:

<field property="beginEmployment" depends="date">
<arg0 key="personal.data.beginEmployment" />
<var>
<var-name>datePattern</var-name>
<var-value>dd.MM.yyyy</var-value>
</var>
</field>


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

Reply via email to