>Perhaps I'm overlooking something here, but from the testing I did this
>afternoon, it appears that the "enabledOnUserRole" attribute provided with
>most
>of Tomahawk's components doesn't work at all in Clay HTML templates. However,
>it does work properly when I use straight JSP/JSF without Clay (at least most
>of
>the time, anyway; t:commandButton seems to have issues with it).
>
>I have an HTML template that contains an element that looks something like the
>following:
>
><input
> type="checkbox"
> jsfid="t:selectBooleanCheckbox"
> value="#{mybean.myflag}"
> enabledOnUserRole="myrole"
>/>
>
>When I view the page while logged in as a user that does not have the "myrole"
>role, the checkbox is still enabled, and I can use it to toggle the
>corresponding flag in the underlying bean. Thinking that it might be a
>problem
>with the implicit mapping of the <input> element, I tried changing the HTML
>element to just a <span> tag (with attributes set as above, minus the
>type="checkbox" part), to no avail.
>
>I also tried setting enabledOnUserRole for a textarea, and it didn't work
>correctly there, either.
>
>visibleOnUserRole seems to work just fine, though.
>
>Any ideas on this, or should I post it to JIRA?
>
This looks like another case where we need to explicitly override the
rendererType.
The shared renderer [1] is the default for the runtime but in tomahawk, there
is a renderer
override [2].
[1]
http://svn.apache.org/viewvc/myfaces/shared/branches/2_0_0/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?view=markup
[2]
http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_1_3/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRenderer.java?view=markup
Could you try the following test to help troubleshoot the problem?
Extend the base check box component definition:
<component jsfid="mySelectBooleanCheckbox" extends="t:selectBooleanCheckbox">
<attributes>
<set name="rendererType" value="org.apache.myfaces.Checkbox"
bindingType="VB" />
</attributes>
</component>
In the html template, point to the override:
<input
type="checkbox"
jsfid="mySelectBooleanCheckbox"
value="#{mybean.myflag}"
enabledOnUserRole="myrole"
/>
I think this should solve the problem but regardless, please create a JIRA
ticket.
>
>For reference, I'm using MyFaces 1.1.4, Tomahawk 1.1.3, and Shale 1.0.4.
>
>
>
>Rich Eggert
>Member of Technical Staff
>Proteus Technologies, LLC
>http://www.proteus-technologies.com
Gary