Yep, that's the simplest solution. If you don't want to emit the
style/styleClass value from a backing bean you can also use a variant
such as
<h:inputText ... styleClass="#{mybean.required ? 'required' : ''}"/>
Regarding your concern about doing this in a data table, you shouldn't
have any problem provided you have the isRequired() method on each row
item in your table model.
L.
CONNER, BRENDAN (SBCSI) wrote:
if you can compute the style you want from the information you have in
one of your managed beans, I believe you can also do one of the
following:
<h:inputText ... style="#{myBean.myStyle}"/>
or
<h:inputText ... style="#{myBean.myStyle}"/>
- Brendan
-----Original Message-----
From: Christian Bohn [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 15, 2006 8:46 AM
To: MyFaces Discussion
Subject: Re: (Validation) required="true" should change my css style of
inputbox e.g. background:red
Hi,
why don't you simply define two inputfields and render only one like
this:
....
<t:inputText rendered="#{<<the EL-expression you used in your
required-attribute or simply true or false}" required="true"
styleClass="red" .... />
<t:inputText rendered="#{! <<the EL-expression you used in your
required-attribute or simply true or false}" required="false"
styleClass="normal" .... />
....
greetings
Chrstian