I'm using the validator with Struts 1.1b3.  The release notes say that b3
fixes an issued with validator that I was having problems with in b2...where
all validations are treated as "required".   The problem I was having with
the date validator has gone away, but I'm still seeing the same problem with
some of the other validators such as mask and maxlength.  I've included a
partial example from the validation.xml for a form, that is validating a
field that should be optional, so I have not specified the "required"
validator in the depends attribute.  I've also included a snippet from the
validation-rules.xml file for the maxlength validator, which was updated in
1.1b3 to remove the "required" validator from the depends attribute.
However, the form still fails validation for the comment field, and I get
back a "required" error message.

Has anyone else had this problem?  Are there fixes for this in the nightly
build?  As a workaround, I can just override the validation method of the
action form and add my validations there, but I kind of like the validator
framework.

  <form name="/admintool/employeeAdd">
      <field
        property="employee.comment"
        depends="maxlength">
            <arg0 key="label.Comment"/>
            <arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
            <var>
              <var-name>maxlength</var-name>
              <var-value>255</var-value>
            </var>
      </field>
    </form>



      <validator name="maxlength"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateMaxLength"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionErrors,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.maxlength">

Thanks,
Cary Mader


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

Reply via email to