Bind <h:message> to inputText [message #471793] |
Mon, 08 May 2006 04:23  |
Eclipse User |
|
|
|
Originally posted by: crapulence.gmx.de
Hello there,
i am trying to bind an error message (required tag) to an inputText of my
form:
<h:form>
name: <h:inputText value="#{Visitor.firstname}" /><br>
surname: <h:inputText value="#{Visitor.lastname}"
></h:inputText><br>
date_of_birth: <h:inputText value="#{Visitor.birth}"
maxlength="10" size="10" required="true">
<f:convertDateTime dateStyle="short"
type="date"/>
</h:inputText>
<br><br>
<h:commandButton action="success" value="Submit" />
<h:message for "#{Visitor.birth}"/>
</h:form>
But thats not right. How to reference the field "date_of_birth" in
h:message?
Best regards,
a.k.
|
|
|
|
|
Re: Bind <h:message> to inputText [message #600339 is a reply to message #471793] |
Mon, 08 May 2006 07:56  |
Eclipse User |
|
|
|
The 'for' attribute takes a component ID, not a value of the component you want to use.
Therefore, you need to give your inputText an ID (it's a good idea to have IDs on all
components, otherwise JSF will create them for you, which sometimes causes problems):
<h:inputText id="dateOfBirth" value="#{Visitor.birth}" maxlength="10" size="10" required="true">
....
</h:inputText>
and then use that ID on the message:
<h:message for="dateOfBirth"/>
Hope this helps.
PS: This is a generic (and very basic) "how to" JSF question, not related to the JSF tooling project
this newsgroup is dedicated to. It would be appropriate in a generic JSF forum, such as
http://forum.java.sun.com/forum.jspa?forumID=427
|
|
|
|
Powered by
FUDForum. Page generated in 0.26722 seconds