Sorry to reply to myself, but I realize that I should have simplified
further.
My fundamental question is simply if there is a way to use the
panelLabelAndMessage's "label" attribute with validation messages for
the component identified by the pLAM's "for" attribute.
Although my original sample reflects my ultimate goal so far, it can be
simplified. The snippet below, which omits the panelHorizontalLayout,
works the same way:
<tr:panelLabelAndMessage label="Zip Code:"
for="zipCode">
<tr:panelGroupLayout layout="vertical">
<tr:inputText simple="true"
id="addressCity" required="true" />
<tr:message for="addressCity"/>
</tr:panelGroupLayout>
</tr:panelLabelAndMessage>
Thanks again.
-----Original Message-----
From: Counsell, Keith M.
Sent: Wednesday, December 13, 2006 9:50 AM
To: [email protected]
Subject: Validation messages and tr:panelLabelAndMessage
Hello,
I would like to use a panelLabelAndMessage within a panelFormLayout to
line up the left-most inputs while having additional components to the
right on some rows. This is working ideally except in the case of
messages. Is there a way to get validation messages for the component
identified with the panelLabelAndMessage's "for" attribute to appear as
the detail in a page's <tr:messages/> tag?
Consider this page:
<tr:form xmlns:f="http://java.sun.com/jsf/core"
xmlns:tr="http://myfaces.apache.org/trinidad">
<tr:messages/>
<tr:panelHeader text="Mailing Address">
<tr:panelFormLayout>
<tr:inputText label="Street:"
id="addressStreet" required="true"/>
<tr:panelLabelAndMessage label="City:"
showRequired="true" for="addressCity">
<tr:panelHorizontalLayout>
<tr:panelGroupLayout layout="vertical">
<tr:inputText simple="true"
id="addressCity" required="true" />
<tr:message for="addressCity"/>
</tr:panelGroupLayout>
<tr:inputText label="State:"
id="addressState" required="true"/>
</tr:panelHorizontalLayout>
</tr:panelLabelAndMessage>
</tr:panelFormLayout>
</tr:panelHeader>
<tr:commandButton text="Submit" id="submitButton"/>
</tr:form>
The messages include the label text for the Street and State inputs, but
the entry for City only indicates that a value is required and does not
have the detail message that would link to the field to correct the
problem. Adding requiredMessageDetail to the City changes the output of
the <tr:message for="addressCity"/> but not the message in
<tr:messages/>. This works perfectly otherwise.
Is there a way to include the panelLabelAndMessage's label in
<tr:messages>? Am I missing something fundamental? Any tips or
solutions would be much appreciated.
Thanks,
Keith