incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Heinisch" <Markus.Heini...@trivadis.com>
Subject How to style a single tr:inputText with a background-color depending on a state?
Date Thu, 31 Aug 2006 15:49:14 GMT
Hi,
 
I want to style required input fields (tr:inputText) with a different background color and
only the <input> element should be affected.
With ADF Faces I used a little trick (see below).
 
Now I want to use Trinidad and the trick doesn't work anymore!
I have found no way to style a single component instance with a style class.
(Don't want to write an inline style for every required form field).
 
The documentation says about attribute styleClass: 
"If in ADF, styleClass and inlineStyle were rendered on the label and the <input>. In
Trinidad, these attributes are rendered on the root dom element."
 
Sorry, have no clue what that means. Does it mean the root of the document or the parent of
the <input> element which is a <td>? 
In the end it make no difference if I use attribute styleClass or not. :-(
 
Any hints are welcome!
 
Thanks,
Markus
 
 

________________________________

From: Markus Heinisch [mailto:Markus.Heinisch@trivadis.com]
Sent: Wed 28.06.2006 18:24
To: adffaces-user@incubator.apache.org
Subject: AW: [SPAM] - Skin Enhancement Request - Bayesian Filter detected spam



Hi Dan,

Are you looking for a solution like this:

            <af:inputText value="#{bindings.Title.inputValue}"
                          label="#{bindings.Title.label}"
                          required="#{bindings.Title.mandatory}"
                          styleClass="#{bindings.Title.mandatory ? 'required' : 'nonrequired'}"
                          columns="#{bindings.Title.displayWidth}">
            </af:inputText>

The EL expression in the attribute styleClass makes the trick. The EL expression resolves
to styleClass="required" when the Title is mandatory (example uses Oracle ADF which provides
for a property like 'Title' some metadata like 'mandatory' or 'updatable').

The styleclass must be defined in a CSS or your Skin-CSS:

input.required, textarea.required, select.required {
  background-color: rgb(255,255,181);
  border-style: solid ;
}
input.nonrequired, textarea.nonrequired, select.nonrequired {
  background-color: white;
  border-style: solid ;
}

>From my point of view everything you need is available to solve your styling needs. ;-)

Cheers,
Markus
------------------------------------------
Markus Heinisch     

Dipl.-Inform.
Consultant

Trivadis GmbH
Freischützstrasse 92
81927 München
Germany

Tel.: +49-89-99275930
Fax : +49-89-99275959
Mobile: +49-162-2959616
mailto:markus.heinisch@trivadis.com
http://www.trivadis.com


> -----Ursprüngliche Nachricht-----
> Von: Dan Robinson [mailto:dannyjrobinson@gmail.com]
> Gesendet: Mittwoch, 28. Juni 2006 18:02
> An: adffaces-user@incubator.apache.org
> Betreff: [SPAM] - Skin Enhancement Request - Bayesian Filter
> detected spam
>
> I don't think this is currently possible, but please prove me wrong!
>
> We'd like to provide a skin configuration that would cause
> certain styles to be appled when a field is marked as
> required.  Specifically, we'd like to cause the input field
> background colour to be changed to make it very obvious that
> it is required.
>
> So far we've only been able to set the background color for
> all elements of an input field (label, tip, etc.).
>
> I guess an extension of this would be to make the label bold etc. etc.
>
> Thanks,
>
> Danny
>



Mime
View raw message