Entry
How can I simulate a "submit" button click?
Dec 4th, 2002 19:05
Ryan Buterbaugh, michael greene,
If I know what your are asking, the answer is pretty simple. The
submit
() function will submit a form. Example:
<html>
<body>
<form name="form1" action="yourscript.cgi" method="yourmethod">
<input type="Whatever" etc>
<! more form stuff >
<input type="button" value="Submit" onClick="submittheform();">
</form>
<script language="javascript">
function submittheform() {
document.form1.submit();
}
</script>
</body>
</html>
That's it. This is useful for checking forms, so that you don't have
it
submit if the browser detects errors