jQuery in Action, 2nd edition
The moose likes JSF and the fly likes h:outputLabel disappears after h:inputText validation fail Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "h:outputLabel disappears after h:inputText validation fail" Watch "h:outputLabel disappears after h:inputText validation fail" New topic
Author

h:outputLabel disappears after h:inputText validation fail

Sergii Olishchuk
Greenhorn

Joined: Jun 19, 2011
Posts: 7
Hi,

Guys, I have a problem with h:outputLabel component. I have the following code:

<h:outputLabel styleClass="desc" value="" for="component_id" />
<h:inputText styleClass="text medium" id="component_id"
value="#{beanForm.val}" required="true" />
<t:message for="component_id" styleClass="fieldError" />

When I leave field blank and make "submit" I see "This is a required field" message and component label disappears. How could I solve this issue with label?

Many thanks

Sergii Olishchuk
Greenhorn

Joined: Jun 19, 2011
Posts: 7
Does anyone know the answer?
Sergii Olishchuk
Greenhorn

Joined: Jun 19, 2011
Posts: 7
Still have this problem. Does someone know how to solve this?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14456
    
    7

Please do not post "bump" messages. If someone knows, they'll answer. If they don't it won't help.

Your value= attribute on the outputLabel has no value in it. So I would not expect it to display anything.

The "value required" error refers to the inputText control, which is not permitted to be empty, since it has the "required" attribute set to "true".


Customer surveys are for companies who didn't pay proper attention to begin with.
Sergii Olishchuk
Greenhorn

Joined: Jun 19, 2011
Posts: 7
Tim Holloway wrote:Please do not post "bump" messages. If someone knows, they'll answer. If they don't it won't help.

Your value= attribute on the outputLabel has no value in it. So I would not expect it to display anything.

The "value required" error refers to the inputText control, which is not permitted to be empty, since it has the "required" attribute set to "true".


Tim, thank you for your reply. My outputLabel has some value let's say value="someValue" (sorry, I missed that one in the code listing above), and I see it untill validation error occurs. But when the message is printed ("this is a required field") label disappears. Could you suggest me something?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14456
    
    7

Best guess I can make is that the label is still there, but it's being squashed into invisibility because of the extra space that the message consumes. Try your browser's "View Page Source" function and see what the generated HTML looks like.
 
I agree. Here's the link: http://jrebel.com/download
 
subject: h:outputLabel disappears after h:inputText validation fail
 
Similar Threads
Need help with passing data between pages through h:commandButton
how to skip validation phase only
JSF Warnings
Duplicate Component ID found in view
SEAM s:decorate template attribute?