Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Action

Status
Not open for further replies.

dowdie

Programmer
Jan 29, 2002
2
IE
Hi
I need to dynamically change a form action depending on the option selected in the list of the form. can this be done. Mabey something like:

<HTML>
<HEAD>
<TITLE>Action Test</TITLE>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>

function setFormAction(){
Item = document.testform.list.selectedIndex;
Result = document.testform.list.options[Item].text;
alert(Result);
var action = &quot; + Result + &quot;.com&quot;;
alert(action);
}


}

</SCRIPT> </HEAD>
<BODY>
<FORM NAME=&quot;testform&quot; ACTION=action>
Select Option: <BR>
<SELECT NAME=&quot;list&quot; SIZE=&quot;3&quot; onChange=setFormAction()>
<OPTION>item1 </OPTION>
<OPTION>item2 </OPTION>
<OPTION>item3</OPTION>
</SELECT>
<INPUT TYPE=&quot;submit&quot;><BR>
</FORM> </BODY> </HTML>
 
You can set document.formname.action to the action you want to perform. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top