Simon, Andrew - thanks for the answers.
Here's another use case I came across today in a real app where it would be
useful
not to show the required icon.
I have a tr:table with 6 columns of editable numbers where each cell is
required.
Labels are given in the column headers using showRequired="true".
The cells do not have labels of their own. Still because the inputText in each
cell
has required="true" the complete page is littered by many dozens of "*"
characters.
I have been able to work around this by adding a style class to the input text
and
hiding the label:
.percentageField af|inputText::label {
display:none;
}
Would be nicer and cleaner if Trinidad would listen to showRequired="false".
Is there a real use case where it makes sense that showRequired="false" is
ignored?
I hope we all agree that use cases are what should drive the implementation?!
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?
>
>