try the pattern

<field name="model.pointOfContact.emailAddress">
etc


 


 

-----Original Message-----
From: James Carr <james.r.c...@gmail.com>
To: Struts Users Mailing List <user@struts.apache.org>
Sent: Thu, Aug 13, 2009 9:53 am
Subject: Re: Validating that two fields match?










I have tried this and it doesn't seem to work at all. I am using
ModelDriven and the model object has a PointOfContact object with an
emailAddress and confirmingEmail attributes.

<field name="pointOfContact.emailAddress">
        <field-validator type="requiredstring">
            <param name="trim">true</param>
            <message>Email Address is required.</message>
        </field-validator>
        <field-validator type="email">
           <message>Please enter a valid email</message>
        </field-validator>
        <field-validator type="expression">
           <param 
name="expression">(pointOfContact.emailAddress.equals(pointOfContact.confirmingEmail))</param>
           <message>Verify that you have entered the same email
address in both fields</message>
        </field-validator>
    </field>

The other two validators above it work.

Thanks,
James

On Wed, Aug 12, 2009 at 5:59 PM, <musom...@aol.com> wrote:
>
>  Check out
> http://struts.apache.org/2.x/docs/expression-validator.html
>
> If you are using annotations check out
>
>  http://struts.apache.org/2.x/docs/expressionvalidator-annotation.html
>
> Your expression will be something like
> @ExpressionValidator(expression="email.equals(confirmEmail)",? message="The 
email fields do not match")
>
>
>
>  Chris
>
>
>
>
> -----Original Message-----
> From: James Carr <james.r.c...@gmail.com>
> To: Struts Users Mailing List <user@struts.apache.org>
> Sent: Wed, Aug 12, 2009 5:30 pm
> Subject: Validating that two fields match?
>
>
>
>
>
>
>
>
>
>
> Hello,
>
> Is there something out of the box that will let me validate if two
> fields match in struts2? An example would be a form with email and
> confirmingEmail fields.
>
> Thanks,
> James
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




 

Reply via email to