You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/02/19 20:32:57 UTC

DO NOT REPLY [Bug 17214] New: - "depends" property of the "validator" element is ignored

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17214>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17214

"depends" property of the "validator" element is ignored

           Summary: "depends" property of the "validator" element is ignored
           Product: Struts
           Version: 1.0 Beta 3
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Validator Framework
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: Steve.Stair@rrc.state.tx.us


The validator element in the validator-rules.xml file has a "depends" property, 
which seems to indicate validations that are preconditions to the current 
validation.

For example, the following definition from the "email" validator seems to 
indicate that a precondition for a field being a valid email address is that 
the field be "required" (i.e. non-null and non-empty).

      <validator name="email"
            classname="org.apache.struts.util.StrutsValidator"
               method="validateEmail"
         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.email">


With this apparent behavior, I should be able to define a field in my 
validation.xml as:

            <field property="login" depends="email">
                <arg0 key="prompt.login"/>
            </field>

Unfortunately, this doesn't work. To get it to work, you must explicitly add 
the "required" validation to the field's depends propery.

            <field property="login" depends="required,email">
                <arg0 key="prompt.login"/>
            </field>

If I have to add "required" to the field myself, what is the purpose of 
the "depends" property of the validator element?

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org