users@javaserverfaces.java.net

Re: Custom validation message for required fields

From: Jan-Kees van Andel <jankeesvanandel_at_gmail.com>
Date: Sun, 20 Jul 2008 12:56:26 +0200

Hi,

I don't think a custom validator for each inputfield is a good solution.
Providing a parameter with the error message is a better solution IMHO.

But there are component libraries that provide those options out of the box.
For example Apache Trinidad provides a requiredMessageDetail attribute on
the tr:inputText component.

See:
http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_inputText.html

Regards,

Jan-Kees


2008/7/20 Uwe Seimet <Uwe.Seimet_at_seimet.de>:

> Hello!
>
> 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?
>
> Best regards Uwe
>
> --
> -----------------------------------------------------------------------
> Dr. Uwe Seimet http://www.seimet.de/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: users-help_at_javaserverfaces.dev.java.net
>
>