Thanks Simon.
That _almost_ does it.
Still two small problems:
Because I wanted to have some vertical space between the fields in the
panelFormLayout
I have (as proposed by the skinning FAQ) this styles in the skin
af|panelFormLayout::label-cell {
padding-top: 5px;
}
af|panelFormLayout::content-cell {
padding-top: 5px;
}
Now there's a vertical misalignment because the padding is applied twice to the
second
panelLabelAndMessage.
I tried to create a specific style for the second panelLabelAndMessage, but:
- a styleClass attribute on the panelLabelAndMessage is completely ignored
- an id "foo" of the panelLabelAndMessage makes it as "foo__xc_" to the html.
Guess, I'll live with the inconsistent placement of the validation error on the
second field.
A more flexible panelFormLayout would be nice, though.
Simon Lessard wrote:
Hello Stephen,
Normally showRequired is used the other way around (show required even
if not) and was maintained in the input field merely from convenience as
this property come from the super class. Have you tried the following to
fix your issue, I think it would work?
<tr:panelLabelAndMessage label="First Name / Last Name"
showRequired="true" for="firstName">
<tr:panelHorizontalLayout> <!-- Adding that one is suckaga, but I did
not find any other way either -->
<tr:inputText id="firstName" simple="true" required="true"
value="#{bean.firstName}" label="First Name / Last Name"/>
<tr:panelLabelAndMessage label="" showRequired="false" for="lastName">
<tr:inputText id="lastName" simple="true" required="true"
value="#{bean.lastName}" label="First Name / Last Name"/>
</tr:panelLabelAndMessage>
</tr:panelHorizontalLayout>
</tr:panelLabelAndMessage>
Regards,
~ Simon
On Fri, Jun 20, 2008 at 10:50 AM, Andrew Robinson
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
Sounds like an enhancement request for panelFormLayout to me
On Fri, Jun 20, 2008 at 4:00 AM, Stephen Friedrich
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:
> I noticed that I can't disable the required icon if
required="true" in a
> tr:inputText.
> So even though showRequired="false", the "*" character is still
shown.
> Looked at the docs and found that "It's a feature, not a bug".
>
> <rant>
> WTFBBQ?
> Does anybody have an idea why the heck somebody explicitly put
this into
> code?
> If a Trinidad user wants to do that, how dare somebody else
decide that it's
> not allowed?
> </rant>
>
> Here's a specific use case where that make sense:
> In a panelFormLayout, I'd like to have a row that contains two
inputTexts,
> like
>
> * First Name / Last Name ______________ ______________
>
> I can do that with a panelLabelAndMessage and nesting the
inputTexts in a
> tr:PanelHorizontalLayout, but wait, there's a problem.
> Usually I would set only the first tr:inputText to simple="true"
(because
> only the first
> element's label and message are shown by panelLabelAndMessage).
> But now the row looks like
>
> * First Name / Last Name ______________
> * ______________
>
> The second asterisk just looks misplaced and ugly.
> The "*" breaks horizontal alignment with other fields in the
second column
> and more importantly somehow the second field is now vertically
misaligned.
>
> So I try settings the second field to simple="true" also and add a
> tr:message for it.
> Argrgrgrgr! Now the validation failure message appears behind the
second
> field rather
> than under it which completely breaks the page layout because the
form gets
> too wide.
>
> So, please, can you make the inputText actually do what I tell
it, when I
> say
> required="true" showRequired="false"
>
> Otherwise: Can anybody propose a solution that keeps fields and
validation
> messages
> correctly aligned, so that I can have on row in a panelFormLayout
contain
> two fields?
>
>