aspose file tools*
The moose likes JSF and the fly likes message required Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "message required" Watch "message required" New topic
Author

message required

rosaria italia
Greenhorn

Joined: May 15, 2006
Posts: 28
Hi, is it possible to pass field's name for validator "required" so I to print next to field validation?
My code jsp
...
<h utputText value="USERNAME" /><h:message for="username" ></h:message>
<h:inputText id="username" value="#{user.username}" required="true"><h:message for="username" style="color: red" /></h:inputText>

My file with custum messages is:
...
javax.faces.component.UIInput.REQUIRED=Value is required.
...

I would that message is: Value for "username" is required.
Thanks.
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
It takes some work, but this reference explains how to do it:
http://www.oracle.com/technology/pub/articles/masterj2ee/j2ee_wk7.html


There is no emoticon for what I am feeling!
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
try

javax.faces.component.UIInput.REQUIRED=Value is required for {1}.


MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
rosaria italia
Greenhorn

Joined: May 15, 2006
Posts: 28
Thanks, I have tried both suggestions but I didn't resolve my problem, would you give me an other explanation, please?
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
What went wrong whem you tried what was suggested in the reference I posted?
rosaria italia
Greenhorn

Joined: May 15, 2006
Posts: 28
Hi Jeff, now works even if not completely !!! Thanks very much your suggestion.
rosaria italia
Greenhorn

Joined: May 15, 2006
Posts: 28
Hello, I'm using PhaseListener, but why in my Application are showed both validation's errors (my personalize messages and default's messages)?
Thanks!
 
Don't get me started about those stupid light bulbs.
 
subject: message required
 
Similar Threads
Customizing validations-h:message
adding rows to a datatable, depending on the array size
jsf and validation
display error message
JSF check if message is empty