Automatic submit a form without pressing enter button.

This example will automatically submit a form to another page without pressing enter button.

The JavaScript must be at the end in your form.

Name in your form action, must be the same as the JavaScript document.'name of form'.submit();

Example code:

<form action="test.cfm" NAME="Add_Update" METHOD="post">
<input name="first_name" type="hidden" value="Your first name">
<input name="last_name" type="hidden" value="Your last name">
<script language="JavaScript">
<!--
document.Add_Update.submit();
//--
</script>
</form>

test.cfm file:

<cfoutput>
#Form.first_name#<br>
#Form.last_name#
</cfoutput>

Advertisement

No User Comments.

No User Comments, be the first one to write your comments?

ApplayIT is owned by Scandic Systems LTD [UK] Company No. 5984000. All other trademarks and copyrights are the property of their respective holders.