You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Michael Heinen <mh...@recommind.com> on 2006/02/22 03:58:40 UTC

simple identification of incorrect fields

Hi all,

 

I display at the top of my page a summary of all error messages. 

 

In addition I try to mark all incorrect fields with a '*' or another
symbol.

Currently I have no idea how to implement this in an easy way. 

 

The following simple approach is not working:

<h:inputText id="searchName" value="#{ControllerBean.searchName}"
required="true"/>

<t:message for="searchName" showDetail="false"
showSummary="false">*</t:message>

 

If I enclose the '*' with a verbatim tag it will be always displayed
(even without errors).

 

I'am sure this is a common requirement therefore this question.

 

Michael

 


Re: simple identification of incorrect fields

Posted by Sean Schofield <se...@gmail.com>.
The required message doesn't work this way.  You need to override the
value in Message.properties if you want to use just an asterisk
character.

The defaults are ...

javax.faces.component.UIInput.REQUIRED        = Validation Error
javax.faces.component.UIInput.REQUIRED_detail = "{0}": Value is required.

If you check the spec docs you can see the various ways to overload
these and replace them with your own.

Sean



On 2/21/06, Michael Heinen <mh...@recommind.com> wrote:
>
>
>
> Hi all,
>
>
>
> I display at the top of my page a summary of all error messages.
>
>
>
> In addition I try to mark all incorrect fields with a '*' or another symbol.
>
> Currently I have no idea how to implement this in an easy way.
>
>
>
> The following simple approach is not working:
>
> <h:inputText id="searchName" value="#{ControllerBean.searchName}"
> required="true"/>
>
> <t:message for="searchName" showDetail="false"
> showSummary="false">*</t:message>
>
>
>
> If I enclose the '*' with a verbatim tag it will be always displayed (even
> without errors).
>
>
>
> I'am sure this is a common requirement therefore this question.
>
>
>
> Michael
>
>