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=12776>.
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=12776

validation order is incorrect

           Summary: validation order is incorrect
           Product: Struts
           Version: 1.1 Beta 2
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Validator Framework
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Validator framework generates such JavaScript function to validate form:

function validateLoginForm(form) {                                             
                     
        if (bCancel) 
      return true; 
        else 
       return validateRequired(form) && validateMaxLength(form); 
   } 

The validation stops if <b>ANY</b> property is empty. I think it should check
<b>ALL<b> properties first and then return errors for all properties.

For example I have such form:

<form name="loginForm">
  <field property="username" depends="required,minlength">
     <arg0 key="login.username"/>
     <arg1 name="minlength" key="${var:minlength}" resource="false"/>
        <var>
           <var-name>minlength</var-name>
           <var-value>7</var-value>
        </var>
  </field>
  <field property="password" depends="required">
     <arg0   key="login.password"/>
  </field>
</form>

1) If I fill "username" property with short text e.g. "tom" and try to submit I
will get message "Field Password is required". 
2) So If I fill "password" property and try to submit I will get message
"Username can not be less than 7 characters."

In my opinion validator shoud return at step 1 two messages:
"Field Password is required."
"Username can not be less than 7 characters."

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

Reply via email to