Issue
I am submitting the form with the help of the below code.
<form name="advanceSalaryUpdate" method="POST" action="MainController" id="advanceSalaryUpdate">
<input type="hidden" name="action" value="updateAdvanceSalaryDetail">
<input type="hidden" name="salID" value="15">
<a href="javascript:document.advanceSalaryUpdate.submit()">15</a>
</form>
But it's gives error "Uncaught TypeError: document.advanceSalaryUpdate.submit is not a function".
Can anyone help on this?
Solution
You should use onclick
event on the anchor text to trigger the click event on the Submit link.
But
I suggest to use the submit button
to submit the form.
<form name="advanceSalaryUpdate" method="POST" action="MainController" id="advanceSalaryUpdate">
<input type="hidden" name="action" value="updateAdvanceSalaryDetail">
<input type="hidden" name="salID" value="15">
<a href="#" onclick="document.getElementById('advanceSalaryUpdate').submit();">Submit</a>
</form>
Answered By - suzan