struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 10782] New: - If two fields are required, and one has a mask, the mask is not checked if the other field is blank
Date Sat, 13 Jul 2002 22:30:26 GMT
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=10782>.
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=10782

If two fields are required, and one has a mask, the mask is not checked if the other field
is blank

           Summary: If two fields are required, and one has a mask, the mask
                    is not checked if the other field is blank
           Product: Struts
           Version: Nightly Build
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Validator Framework
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: turner@blackbear.com


You have two validated fields in a form, both of which have "required" as a 
validation, and one of which has a mask as a validation.  The one which is 
only required is field2, the one with "required,mask" is field1.

If field2 is blank and field1 has a value that fails the mask, no error is 
generated for field1.

If field2 is non-blank, field1 is validated properly.

TEST CASE

If you put the following in struts-config:

<form-bean name="testForm" 
type="org.apache.struts.validator.DynaValidatorForm">
  <form-property name="field1" type="java.lang.String"/>
  <form-property name="field2" type="java.lang.String"/>
</form-bean>

<action type="<someaction>" name="testForm"
path="/testAction" input="/testAction.jsp" validate="true"/>

And the following in your validation.xml
  <form name="testForm">
   <field
     property="field1"
     depends="required,mask">
     <var>
      <var-name>mask</var-name>
      <var-value>^[a-z]</var-value>
     </var>
    </field>
   <field
     property="field2"
     depends="required">
    </field>
  </form>


And testAction.jsp has:
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="tmp" %>

<html:errors/>
<html:form action="/testAction">
Field 1: <html:text property="field1"/><BR>
Field 2: <html:text property="field2"/><BR>
<html:submit/>
</html:form>

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


Mime
View raw message