Forum Moderators: open
What I am trying to do is to have a from that submits to a different perl script depending on the first part of the users post code.
The idea is simple, run a small javascript that updates the action of the form, but whatever I try it will not work!
I know that it should work, because if I change the last line in the javascript to
document.contactform.testTxt.value= reqAction;
it puts the required text in to a text area (testTxt).
Here is the code that I'm using.
JAVASCRIPT
function emailLocation()
{
formElement = document.contactform.pCode[document.form1.pCode.selectedIndex];
reqAction = formElement.value + "Mail.pl"
document.contactform.action = reqAction;
}
HTML
<form action="" method="post" name="contactform">...
<select name="pCode" onchange="emailLocation()"><option value="gary">LE</option><option value="boyd">YO</option><option value="ian">G</option><option value="jason">SL</option></select>
...</form>
Why wont it work...
...please help!