Javascript to automatically submit/post a form



<script>

function myupdate(myform) {
document.forms[myform].submit();
}

</script>



From your html element, add:

onchange="myupdate('formupdate')" 

Replace "formupdate" with the actual ID of your form you want to submit.


NOTE:   you will get an error message "submit is not a recognized function" if you have a submit button with a name or id of "submit".   Rename your submit button to be "mysubmit" or something like that.


UPDATE:   another approach that works:

onchange="this.form.submit()"





Comments