0 Replies Latest reply on Jul 3, 2008 3:02 PM by timgozag

    Calling a4j:commandButton from a Java script  - PLS Help

    timgozag

      Hi,

      I am implementing a search on IE when users hit Enter to submit a form.
      I have this a4j commandButton to perform a search.

      <a4j:commandButton id="Search" type="Submit" value="Search"
      actionListener="#{searchBean.search}"
      reRender="resultsPanel" ignoreDupResponses="true"
      onclick="hideMsg();"
      oncomplete="showModal(#{searchBean.showModal}"/>

      I tried to call this button from this Java script:
      function hitEnter(event){
      var keycode = (window.event == null) ? window.event.keyCode : event.which;
      if(keycode == 13){
      searchButton= #{rich:element('Search')};
      searchButton.click();
      return false;
      }
      return true;
      }

      The button got called but it didn't work properly. The javascript of the a4j button in oncomplete does not get called.
      I tried some other ways such as calling onclick, or created a js:function then call that a4j function from the javascript but it didn't work.
      I saw a bug about onclick here http://jira.jboss.org/jira/browse/AJSF-136. Does it relate to what I am doing
      Does anyone have any idea or any way to implement this? Thanks a lot!