"t:inputText" tag, disabledOnClientSide crash with onchange
-----------------------------------------------------------

                 Key: TOMAHAWK-1468
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1468
             Project: MyFaces Tomahawk
          Issue Type: Bug
            Reporter: Cosmin Martinconi
            Priority: Minor


When using the "_t:inputText_" tag, with the "_disabledOnClientSide_" and 
"_onchange_" attributes, Tomahawk creates a bug by crashing the "_onchange_" 
listener.

I reproduced the issue after this steps:

 1. Using the specified tag with the two attributes, like this:
{code} 
<t:inputText id="someId" value="#{beanName.aValue}"
             disabledOnClientSide="true" onchange="onChangeJSFunction();">
</t:inputText>
{code} 
 2. Create a component that enables the "_t:inputText_" field on the client 
side:
{code}
<script type="text/javascript" charset="utf-8">

function enableTag() {
   var tagRef = document.getElementById('someId');
   tagRef.disabled=false;
}
</script>
{code}
 A link, and a button:
{code}
<a href="#" onclick="enableTag()"> Enable </a>
<h:commandButton value="refresh" action=""/>
{code}
 3. In the running application press the "_Enable_" link, that will enable the 
"_t:inputText_" field. Change the value of the field and press the "_refresh_" 
button.

The issue consists in that the value modified for the "_t:inputText_" field is 
not stored in the "_beanName.aValue_". The explanation of this is that, if the 
"_disabledOnClientSide_" atribute is used, Tomahawk introduces a JS method for 
the "_onchange_" listener, and if we use this attribute it crashes. That's 
because the "_onchange_" value is not properly added to the ResponseWriter.

I have attached a patch with the fix. It consist of adding the necessary value 
of "_onchange_" before rendering the attributes.

Regards,
Cosmin

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to