2 Replies Latest reply on Sep 13, 2007 2:11 PM by Maksim Kaszynski

    using a4j:support with JS event handlers

    Rimantas Zukaitis Newbie

      Hello,

      I have following code:

      <h:inputText id="txt1" value="#{sampleBean.person.name}"
       onchange="validate_txt1();">
       <a4j:support event="onchange" ajaxSingle="true" rerender="output"/>
      </h:inputText>
      


      As far as I understand, a4j:support component is ignored and does not render any AJAX invocation code, since inputText already has JavaScript handler defined for the same event. Is this right?

      I yes, is there any way to workaround this behavior? I would like hardcoded JS handler to be invoked before a4j:support call.

      I have two following scenarios, when JSF page is modified dynamically by some custom container component, when such behavior becomes an issue:

      1) There is JSF page with input controls, some of them have hardcoded JS event handlers for onchange events. When parent container is rendered, JSF tree is modified and a4j:support componenets are added to some of input controls. Due to issue, described above, a4j:support is not working for those controls, which have JS event handlers predefined.

      2) The second case is reversed - I have JSF page with input contorls, some of them have a4j:support elements defined. When I dynamically add onchange JS event handler, a4j:support elements stop working..

      Any ideas how can workaround in any of these situations?