The styleClass attribute for the form components goes on the root dom
element of the component, which isn't the <input> or <textArea>. We
should be doing this for all our components, and if we are not, we'll
need to enhance them to do this. This is for consistency, and it makes
it easier to write skinning rules.
In the case of inputText where changing the styles of the 'content' (aka
the input/textArea) piece of the component is common, we've added a
'contentStyle' attribute. So you can essentially do what Markus
suggested, but use the contentStyle attribute. By essentially, I mean
that contentStyle takes styles, not style classes. So you would do this:
contentStyle="#{bindings.Title.mandatory ? 'background-color:
rgb(255,255,181);border-style: solid ;' : 'background-color: white;
border-style: solid ;'}"
I just thought of another way you can do this using the skinning file.
Do what Markus suggested, but I would change the name of the styleClasses:
<af:inputText value="#{bindings.Title.inputValue}"
label="#{bindings.Title.label}"
required="#{bindings.Title.mandatory}"
styleClass="#{bindings.Title.mandatory ?
'requiredFieldMarker' : 'nonrequiredMarker'}"
columns="#{bindings.Title.displayWidth}">
</af:inputText>
The in the skinning file you can do this:
/* When the af|inputText's component has the styleClass set to
requiredFieldMarker, set its 'content' piece */
af|inputText.requiredFieldMarker::content {
background-color: rgb(255,255,181);
border-style: solid ;
}
- Jeanne
Markus Heinisch wrote:
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:[EMAIL PROTECTED]
http://www.trivadis.com
-----Ursprüngliche Nachricht-----
Von: Dan Robinson [mailto:[EMAIL PROTECTED]
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