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, <[email protected]> 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 <[email protected]>
> To: Struts Users Mailing List <[email protected]>
> 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: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]