users@javaserverfaces.java.net

Re: Custom validation message for required fields

From: Raymond DeCampo <rdecampo_at_twcny.rr.com>
Date: Sun, 20 Jul 2008 11:53:36 -0400

Uwe Seimet wrote:
> My application has several required text input fields and I would like
> to display different validation error messages for each (empty) field.
> Assigning to the javax.faces.component.UIInput.REQUIRED property changes
> the validation error message only on a global scope.
> Do I have to write a custom validator for each required input field in
> order to provide a different error message for each field or is there an
> easier way to solve this?
>
If you are using JSF 1.2, all the standard components have a
requiredMessage attribute for exactly this.