2 Replies Latest reply on Nov 23, 2010 11:24 PM by Rajendra J

    problem in form submission after validation

    Rajendra J Newbie

      Hi Guys,

       

      I have a form with multiple fields, in command button for onclick event i have given one validation through java script its executing fine now the problem is after validation success its not able to sumit the form. Its unable to call Java method . Means to say form is not submitting...

       

      Can anybody please give me the solution..

       

      Here Im pasting my code:

       

      <a:commandButton id="SaveId"
                                   value="Save"
                                   type="submit" 
                                  onclick="return valid(this.form);"

                                  action="#{Bean Name.SaveMethod}"
                                  reRender="roomForm"
                                  oncomplete="document.getElementById('Form:RNub').focus();"/>    

       

      This is my java script function:


          <script type="text/javascript">


              function valid(form)


              {


                  var Rnub = form["Form:fieldNub"].value;


                      if (Rnub == "")

                      {
                          alert("Please Enter RoomNumber");
                          form["Form:fieldNub"].focus();
                          return false;
                      }

       

                  var Blocked= form["Form:BlkNo"].value;
                      if (Blocked == "")
                      {
                          alert("Please Enter Block");
                          form["Form:BlkNo"].focus();
                          return false;
                      }


                // form.submit();


               return true;


              }   


          </script>   

       

      In the above code form.submit() also I have tried and without that also

       

      I have tried but the form is not submitting.

       

      Please can any body give a solution.

       

      Waiting for suggessions

       

      Thanks in advance