Metal KoRn wrote:
Hey guys I need to validate two fields for password and confirmation but I can get the jakarta example work can anybody tell me how to do taht with struts?


Here is a snippit of validation rule from our live application

<field property="passwordConfirm" depends="required,validwhen">
        <var>
                <var-name>test</var-name>
                <var-value>(passwordConfirm == password)</var-value>
        </var>
        <msg name="required" key="error.required.field.null" />
        <msg name="validwhen" key="error.field.match.failed.password"/>
        <arg position="0" key="passwordConfirm" />
        <arg position="1" key="password"/>
</field>

1. password is the name of the field for entering password
2. passwordConfrim is the name of the second field
3. passwordConfrim is required, and is only valid when:
        a. passwordConfirm == password
4. msg "required" is displayed when user doesn't enter anything in passwordConfirm field
5. msg "validWhen" is displayed when password != passwordConfrim
6. arg are variables/arguments passed for formatting of message.

the msg "required" and "validWhen", along with arg "passwordConfirm" and "password" are defined in .properties files (used for localisation).


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

Reply via email to