dev@javaserverfaces.java.net

Re: Should disabledClass be applied to select element too?

From: Jayashri Visvanathan <Jayashri.Visvanathan_at_Sun.COM>
Date: Wed, 14 Sep 2005 18:04:00 -0700

Hi Mike,
  I think I understand your problem better now, thanks.
As far as I remember, perhaps Roger and other EG members can correct me
here if I am wrong, the "disabledClass" and "enabledClass" on select tag
were meant to applied to options and not to the element itself because
if you are planning to use the same style class on all options then they
don't have to be repeated on every option.
   Coming back to your question, assume a scenerio where the two options
have different values for "disabledClass" which one would you apply on
"select" tag ? Thats one possible explanation for the current behavior.
In any case, I'll let Roger decide if it needs to be spec chande
although std. Renderkit docs don't discuss it in detail.

Regarding "disabled" being rendered on select tag, are you sure about it
? I have a test case where I see its not being rendered and I think its
because of the following code in MenuRenderer

// don't render disabled here, because it is dealt with in a
    // special fashin further down the callstack.
        Util.renderBooleanPassThruAttributes(writer, component,
                         new String [] {"disabled"});
Thanks
-Jayashri
 


Michael Youngstrom wrote:

>Perhaps I didn't explain the problem correctly before. Let me try again. :)
>
>This JSF 1.1 code:
>
><h:selectManyListbox disabledClass="grey" disabled="true">
> <f:selectItem itemValue="10" itemLabel="Test"/>
></h:selectManyListbox>
>
>Will render to HTML like this:
>
><select name="_id1" multiple="multiple" disabled="disabled">
> <option value="10" class="grey">Test</option>
></select>
>
>This is how I would expect it to be rendered:
>
><select name="_id1" multiple="multiple" disabled="disabled" class="grey">
> <option value="10" class="grey">Test</option>
></select>
>
>So the disabled attribute is getting correctly passed through. The
>problem I'm having is the selectManyListbox disabledClass="grey" is
>only getting applied to the option elements and not the select
>element. Perhaps I'm misunderstanding the purpose of disabledClass
>but my thought was that disabledClass was used as a style to apply to
>a disabled element to make it look disabled when the element is
>disabled since not all browsers grey out disabled form elements when
>they're disabled.
>
>So the problem I'm having is the select multiple form element is not
>getting the "grey" style rendered to make it look disabled when I
>disable it. Only the options are getting the disabledClass style
>applied. So, my question is can the MenuRenderer be changed to apply
>the disabledClass style to the select element as well as the options
>if the component is disabled?
>
>Mike
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
>For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>
>
>