CODECUBE VENTURES

Programmatically post any form

This Javascript function will post a form to any URL... useful for posting after running through some client side form validation...

also useful for posting to a new window... just open the new window, and then put the name of the new window in the third parameter.

parameters:

  • form - the actual form object (document.form1)

  • url - the URL .. relative or absolute

  • target - any valid target (frame name, _new, new window name)

function JM_postTo(form, url, target) {
if (target != undefined )
{
form.target = target;
}
form.action = url;
form.submit();
}

Latest post: Digging Up the First Version of CodeCube

See more in the archives