This is a very common thing to do and should be done with the validWhen validation as described on the Validotor page of the Struts User Guide (http://struts.apache.org/1.x/userGuide/building_view.html#validator).

Below is the validation I use on a change password form as an example:

<form name="changePasswordForm">
  <field property="passwordCurrent" depends="required">
   <arg0 key="login.changePassword.currentPassword.label"/>
  </field>
  <field property="passwordNew" depends="required, minlength">
   <arg0 key="login.changePassword.newPassword.label"/>
   <arg1 name="minlength" key="${var:minlength}" resource="false"/>
   <var><var-name>minlength</var-name><var-value>6</var-value></var>
  </field>
  <field property="passwordNewVerify" depends="validwhen">
   <arg0 key="login.changePassword.newPwsNotEqual"/>
   <var>
    <var-name>test</var-name>
    <var-value>(*this* == passwordNew)</var-value>
   </var>
  </field>
 </form>

HTH,

Bart.

Rauf Khan wrote:
Hi,

I trying to validate the fields using Validator Framework at client side,
Iam not able to validate the password & confirmpassword fields inorder to
show an alert msg if password & confirmpassword fields are not same. Can i
know how to handle this case.

<html:password property="password"/>
<html:password property="confirmpassword"/>

Thanks in advance.

Regards
Khan



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

Reply via email to