Wednesday, April 4, 2012

Auto redirect a form when page loads

To redirect a form onload, set the onload event of the body

<html>
  <body onload="document.TheForm.submit();">
    <form name="TheForm" action="redirectURL" method="post">
      <input type="hidden" name="ID" value="valueToPass" />
    </form>
  </body>
</html>

*Note: setting a hidden input name/value pair will allow the receiving URL to pull and use that info being sent.

No comments: