I'm doing password field validation using 'validwhen'. I have a user form used for multiple purposes (create a user, modify a user with optionally changing the password). So I have my password and passwordConfirm properties set up, but I'm stuck at the last part--making sure the passwords match. Here's what I have in my validation.xml:

           <field property="password" depends="validwhen">
               <arg key="user.term.password" />
               <var>
                   <var-name>test</var-name>
<var-value>(((userId != null) and (passwordConfirm == null)) or (*this != null))</var-value>
               </var>
           </field>
           <field property="passwordConfirm" depends="validwhen">
               <arg key="user.term.passwordConfirm" />
               <var>
                   <var-name>test</var-name>
<var-value>((userId != null) and ((password == null)) or (*this != null ))</var-value>
               </var>
           </field>

So the "password" field is valid if any of the following are true:
- It's filled in with a value.
- It's left blank, and password confirm is also left blank and we're modifying an existing user (userId).

The validity of the "passwordConfirm" field is determined the same way, only with password and passwordConfirm swapped.

So my question is, how can I add in the check to make sure password==passwordConfirm? Right now, these validations will give "Password is required." or "Password Confirm is required.", but I need a third message on one of the properties saying, "The entered passwords do not match." Can I just add an additional <field property="password"...?

- Scott


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

Reply via email to