onChange not Firing with Richfaces

406 views Asked by At

What's wrong with the following code ? I am trying to fire an onchange event but it doesn't fire. Any tricks?

<h:inputText id="productIdField" required="false" styleClass="txt" >
    <f:validateLength minimum="2" />
    <rich:toolTip showDelay="500"  styleClass="bgcolor-white">
    </rich:toolTip>
    <a:support event="onchange" ajaxSingle="true"  requestDelay="250" action="testChange();"/>
    </h:inputText>

Javascript :

function testChange(){

                alert('TestChange');

                }
1

There are 1 answers

0
Predrag Maric On BEST ANSWER

action attribute is used for referencing a method in some bean which should be invoked when event is triggered, not a javascript function. From the documentation

type: javax.el.MethodExpression (signature must match java.lang.Object action()) - MethodBinding pointing at the application action to be invoked...

Example:

<h:inputText value="#{bean.text}">
      <a4j:support event="onkeyup" reRender="output" action="#{bean.action}"/>
</h:inputText>