Thank you for the suggestion I did that for one of the fields (the one in
the example) but many of the others are of the type:
<tr:inputText id="order_id" disabled="true" columns="10" simple="true"
value="#{empty o.id ? 'Pending' : o.id}" />
That is, they have conditional expressions in the value attribute. Those are
always displayed as read only fields. Setting a default value for id is not
an option for several reasons.
I guess I would have to make a new component for my desired behavior. For
now what I did is to style the div similar to the input.
Thanks.
On Wed, Feb 23, 2011 at 5:12 AM, Cédric Durmont <[email protected]> wrote:
> you could always add a bogus setter... Not very clean, but you could
> use a getter/setter pair in a bean, the setter would do nothing,
> whereas the getter would grab the value from your business object "u"
>
> Regards,
> Cedric
>
> 2011/2/23 A. Nieves <[email protected]>:
> > I was mistaken. They are displayed as div's because they are read only
> > fields. Is there any way to display read only fields inside input
> elements?
> >
> > On Tue, Feb 22, 2011 at 9:39 PM, A. Nieves <[email protected]>
> wrote:
> >
> >> I have several tr:inputText inside trh:tableLayout and for some values
> the
> >> resulting HTML does not include the input element but only a div. For
> >> example, I have:
> >>
> >> <trh:tableLayout>
> >> <trh:rowLayout>
> >> <tr:inputText id="username" disabled="true" columns="10"
> >> simple="true" value="#{u.username}" />
> >> <tr:inputText id="fullname" columns="50" value="#{u.fullName}"
> >> disabled="true" simple="true" />
> >> </trh:rowLayout>
> >> </trh:tableLayout>
> >>
> >> The code above will always display the following inside the table.
> >>
> >> ...
> >> <td>
> >> <span class="af_inputText p_AFDisabled">
> >> <input id="username" type="text" value="regularUser" size="10"
> >> class="af_inputText_content" disabled="" name="username" >
> >> </span>
> >> </td>
> >>
> >> <td>
> >> <span id="fullname" class="af_inputText p_AFReadOnly">
> >> <div class="af_inputText_content">Regular User</div>
> >> </span>
> >> </rd>
> >> ...
> >>
> >> The second input always render as a div. It happens for some of the
> fields
> >> but not for all. There doesn't seem to be any common characteristics of
> the
> >> inputs that get displayed as div's.
> >>
> >> Any hints of what might be the problem and where should I start
> debugging?
> >>
> >> I'm using Trinidad 1.2.14 with Facelets.
> >>
> >> Thanks.
> >>
> >>
> >
>