You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Val Blant <va...@yahoo.ca> on 2006/06/09 22:38:04 UTC

Problem with enabledOnUserRole

I was very excited to find 'enabledOnUserRole' attribute on all tomahawk
input fields, b/c they do exactly what I need in my app - disable fields
based on user role. Unfortunately, using 'enabledOnUserRole' has a side
effect that makes it useless to me. Unless I am missing something...

The page displays correctly, but when the page is submitted, since some
input fields are disabled, the browser doesn't send their values to the
server. Not only does this fire all of the change listeners attached to the
disabled fields, but more importantly, the model is updated with nulls where
there used to be values. 

Is this the expected behavior? Is there a way around this? It seems that
having 'enabledOnUserRole' is not that useful if it's going to overwrite all
of your model data with nulls...
--
View this message in context: http://www.nabble.com/Problem-with-enabledOnUserRole-t1763951.html#a4800751
Sent from the MyFaces - Users forum at Nabble.com.


Re: Problem with enabledOnUserRole

Posted by Val Blant <va...@yahoo.ca>.
Now it is starting to look like a bug to me. Here is a bit more info.

During the decode phase,
org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlRendererUtils.isDisabledOrReadOnly()
method is used to determine if the component for the input field is
disabled. The check is done like this:
isTrue(component.getAttributes().get("disabled"))

However, during the encode stage, we never set setDisabled(true) on the
component! We simply rendered it as disabled in
HtmlRendererUtils.internalRenderSelect(). Therefore the decode phase doesn't
know that the component is disabled and thus sets the submittedValue to
null, which leads to erroneous validation and model update. 

I will enter this info into JIRA.
--
View this message in context: http://www.nabble.com/Problem-with-enabledOnUserRole-t1763951.html#a4801320
Sent from the MyFaces - Users forum at Nabble.com.