1 Reply Latest reply on Jun 28, 2007 12:15 PM by sergeysmirnov

    Form Action Method not getting called if using Java Script i

    shipra

      Hi,
      I'm facing a very strange problem.
      I'm using a simple client side Java Script Function
      function changeSchoolListTemp()

      {
      while (document.registerForm.elements["registerForm:schoolsel"].options.length > 0)
      {
      document.registerForm.elements["registerForm:schoolsel"].remove(0);
      }
      alert("d**************8");

      var countryName="Arab";
      var countryId="12";
      document.registerForm.elements["registerForm:schoolsel"].options[0]= new Option(countryName, countryId);

      }
      I'm calling this function on a onChange Event of Select Box in a JSF Form:

      <h:selectOneMenu id="orgState" onchange="changeSchoolListTemp();"> <f:selectItems value="#{registerBean.stateCodes}"/> </h:selectOneMenu> <f:verbatim></f:verbatim>
      <h:outputText value=" "/>
      <h:message for="orgState" styleClass="formUserError"/>



      Whenever I execute this code, the options are added in the Select Box.
      But when I submit the form, the Action Method does not get called and the changes due to the JavaScript function also get lost.

      Please help me out. I've tried many things but it is not working!!