6 Replies Latest reply on Apr 18, 2008 1:32 AM by ybxiang.wolf

    Help!A strange problem: a4j:form can not execute onsubmit wh

    ybxiang.wolf

      Help!A strange problem: a4j:form can not execute onsubmit when only one input included.


      I put two inputtext in a4j:form and press enter key, it works correctly.
      but if there's only one inputText in the a4j:form, one javascript error occurs:"Object required".


      Here is the code that works:
      --------------------------------------------------------------------
      <a4j:form id="objectSearchForm" reRender="dataTable,pager" ajaxSubmit="true"
      onsubmit="return isEnterKeyPressed();" styleClass="box">

      <h:inputText styleClass="full_length" value="#{permissionSearchingAction.pageSize}"/>
      <h:inputText styleClass="full_length" value="#{exampleObject4PermissionSearchingAction.englishName}"/>


      <h:commandButton id="find" action="#{permissionSearchingAction.find}" value="Find"/>

      ...rich:datatable to show results
      </a4j:form>
      --------------------------------------------------------------------




      Here is the code that does not work:
      --------------------------------------------------------------------
      <a4j:form id="objectSearchForm" reRender="dataTable,pager" ajaxSubmit="true"
      onsubmit="return isEnterKeyPressed();" styleClass="box">

      <h:inputText styleClass="full_length" value="#{permissionSearchingAction.pageSize}"/>



      <h:commandButton id="find" action="#{permissionSearchingAction.find}" value="Find"/>

      ...rich:datatable to show results
      </a4j:form>
      --------------------------------------------------------------------



      -----------------------used javascript:

      function isEnterKeyPressed(){
      if(event.keyCode==13){
      return true;
      }
      }







      I have tried
      <a4j:form id="objectSearchForm" reRender="dataTable,pager" ajaxSubmit="true"
      onsubmit="alert('a')" styleClass="box">

      when i press enter key, it popup a alert dialog correctly.
      Why the form cannot summit when there is only one inputText???
      Why the form can DO summit when there are two more inputTexts???

      Please help me! I have spent over 6 hours on it!




      My framework:
      jboss-seam-2.0.2.CR1+richfaces-ui-3.1.4.GA


      I have tried richfaces-ui-3.2.0.GA, but it can not submit chinese correctly!!!