Hi everyone,

For some sort of reason, I'm using Struts version 1.1b2. I have a search
screen where the user can search using some date fields. I put the
following field declaration in my validations.xml file

   <field property="endDate" depends="date">
    <arg0 key="forms.project.endDate"/>
    <var>
     <var-name>datePattern</var-name>
     <var-value>${dateFormat}</var-value>
    </var>
   </field>

The date validator is declared as follows in my validator-rules.xml
(without the JavaScript)

      <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">

Although the validator declares that it depends on required, so (as far
as I understand) that means it should not be triggered if the value is
null or blank. Nevertheless, it is, and it shows the error that the date
is invalid. I checked the source for the class that performs the
validation, and obviously it adds the error to the errors collection if
the value is null or blank. But I think it's not supposed to even get
called, because in the declaration of the validator, it says it depends
on required.

Is this a bug in this old version, or am I doing something wrong?

Any help is appreciated.

Thanks,
Tarek Nabil

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

Reply via email to