Send Extra Data With Submit

[Total: 0    Average: 0/5]

This shows how to have a variable set by javascript sent with the form posting.

Body Code:

<!--
  This shows how to use a javascript variable in a form component that is
  set just before the form is submitted.
-->
<script>
var BOOLEAN_VAR=false;

function validateForm()
{
  /*
   * do some form processing.
   * return true if this form is okay to submit
   *
   * Since this example is not set up to show how to validate
   * a form - this function will return true.
   */
   return true;
}

function doIt()
{
  document.f1.repeated.value=BOOLEAN_VAR;
  return validateForm();
}
</script>
<form name=f1 action="http://www.somesite.com/page.html" onsubmit="return doIt()">
<input type=hidden name=repeated value="false">
<input type=submit value="click to submit">
</form>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *