Hi Stephen,

We have that use case all the time and it's really where simple="true"
shines. However, it does mean that you have to add tr:message components
though. That being said, I agree that there should be an easier way to have
an input component and its message bundled together somehow without having
to specify a label as well since the way you're currently using means that
there might be some offset to the left of the component where the label
would have appeared. Also, the way you're using implies label="" which mean
the FacesMessage won't include the field's label and the link to that field.


Regards,

~ Simon

On Mon, Jun 23, 2008 at 5:12 PM, Stephen Friedrich <[EMAIL PROTECTED]>
wrote:

> 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?
>>     >
>>     >
>>
>>
>>
>

Reply via email to