Changing the Action of a Form

by "Christie Cooksey" <christie(at)thearmidalemall.com>

 Date:  Mon, 22 Oct 2001 10:39:54 +1000
 To:  "HWG-Techniques" <hwg-techniques(at)hwg.org>
  todo: View Thread, Original
>From PPK's site:
"Finally, you can change the ACTION of a form if you want to:
document.forms[0].action = 'the_other_script.pl';
This can come in very handily if a form has to be submitted to another
script in some cases."

Okley Dokley...
I'm a shocker and I've obviously gotten some sytax grossly incorrect.  If I
try to use the code below it tells me that document.formName is not an
object.  Could someone please help?

<script language="JavaScript">
<!--
{
document.formName.action =
document.formName.group.options[document.formName.group.selectedIndex].value
;
}
// -->
</script>

<form name="formName" action="cgi-bin/script1.cgi" method=post>
  <select name="group" size="1">
 <option>Select a List</option>
 <option value="cgi-bin/script1.cgi">Option1</option>
 <option value="cgi-bin/script2.cgi">Option2</option>
 </select>
 <input type="submit" name="Submit" value="Submit">
</form>

Cheers  :0)
Christie Cooksey

"Those who would give up essential liberty,
to purchase a little temporary Safety,
deserve neither Liberty nor Safety."
-- Benjamin Franklin

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA