struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Axel Stahlhut" <astahl...@neusta.de>
Subject Problems using the date-Validator with non required attributes
Date Sun, 01 Sep 2002 11:12:50 GMT
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>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message