You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Asad Habib <ah...@engin.umich.edu> on 2006/04/13 01:20:21 UTC

Associating Multiple Messages with a Validation Rule

Is there a way to associate multiple messages with a single validation 
rule? In particular, I would like to associate multiple messages with the 
required rule so that I can have a different message displayed depending 
on the field being validated. Thanks.

- Asad

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Associating Multiple Messages with a Validation Rule

Posted by Niall Pemberton <ni...@gmail.com>.
On 4/13/06, Asad Habib <ah...@engin.umich.edu> wrote:
> Is there a way to associate multiple messages with a single validation
> rule? In particular, I would like to associate multiple messages with the
> required rule so that I can have a different message displayed depending
> on the field being validated. Thanks.

Yes you can use a message element for the particular field to override
the "default" required validator message

<field property="foo" depends="required">
     <msg name="required" key="foo.required.error"/>
</field>

Niall

> - Asad

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org