title: form action and sumbit button onclick function are not working together
body: <pre><code>&lt;form name="payform" method="POST"&gt;
  &lt;input style="display:none" id="txnid" name="txnid" ng-model="transactionid" /&gt;
  &lt;input style="display:none" id="productinfo" name="productinfo" value="bill payment" /&gt;
  &lt;input style="display:none" id="mobileNumber" name="phone" ng-model="mobileNumber" /&gt;
  &lt;input id="buttonPay" type="submit" class="mdl-button" value="SUBMIT" onclick="prePay()" &gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>my html code looks like this. i have to post the contents of textboxes to pay.jsp file. and i have to perform some additional operations on the submit button's onclick event.</p>
  
  <pre><code> prePay=function(){
  
  ...
  ...
  ...
  
  document.getElementById("payform").action = "/pay.jsp";
       document.forms["payform"].submit();
    }
  </code></pre>
  
  <p>but when i click submit button the onclick function is not working. just redirecting to the page</p>