Happy New Year and hello Ranchers, this is my first posting for 2013.
I have an issue with styling h:selectOneListbox and would most appreciate some advice. Hopefully it should be easy to answer, but I cannot find an obvious solution. In my bean I have a fragement of code as follows:
which works correctly and sets some items I want displayed to be disabled, although most are enabled. In fact the items are the 92 chemical elements from Hydrogen to Uranium, but several of them have abundances that can be completely neglected, such as Promethium. I still want these displayed in the menu, but disabled.
In the xhtml code here, I have a class for the enabled and disabled entries:
with the corresponding styles set here:
Using Firefox the items are formatted correctly, with the disabled items also being formatted, but grayed out. For some reason, even though the style itemDisabled is exactly the same as itemEnabled, it is still grayed out. If itemDisabled is omitted, it is still grayed out, but not monospaces, which is to be expected.
However, using Internet Explorer or Chrome the text is not monospaced, neither the enabled or disabled text. How do I fix that? Also, I notice that the attributes for h:selectOneListbox also include styleClass, but how does that fit in with enabledClass and disabledClass?
Some advice would be most appreciated - many thanks.
styleClass is the master style for the control. It should convert to "class=" on the generated HTML SELECT tag. The other styles are for internal components, and usually would cascade back the the styleClass.
Browser-specific quirks are not indulged by the core JSF tagset - you'll get the same results as if you had coded simple SELECT and OPTION tags. The best way to tweak things is to do a View Source on the resulting page and see what HTML was generated, then play with the JSF options until you get what you like. Which may not be what you want, since there are limits to how much basic HTML can be tweaked for any given browser. That's the browser's fault, not JSF's.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Dec 12, 2007
Ok, many thanks, and that is something I will look into. In fact as I am starting to convert some of the tags to PrimeFaces, that may also be a solution.
In the mean time a more serious issue has turned up, and will post this on another thread.