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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting ACTION on FORM tag equal javascript variable

Status
Not open for further replies.

dharmer1975

Programmer
Apr 6, 2001
11
US
I've got a variable called test that I declare in the following function in an include file:
------------------------------------
function checkApplication() {
if (document.jolApply.platform.options[document.jolApply.platform.selectedIndex].value == "null") {
alert ("Please select a platform");
return false;
}
else
if (document.jolApply.url.options[document.jolApply.url.selectedIndex].value == "Choose") {
alert ("Please select a category");
return false;
}
else {
var test = document.jolApply.url.options[document.jolApply.url.selectedIndex].value;
alert (test);
return true;
}
}

---------------------------------
My FORM tag reads as follows:
<FORM name=&quot;jolApply&quot; ACTION=test onsubmit=&quot;return checkApplication(this.jolApply)&quot;>


I want to link to a relative URL that is contained within my variable 'test'. How can I get my page to navigate to the URL within 'test' when I click my submit button? I don't know the syntax for calling the variable in the FORM tag. Any assistance would be greatly appreciated. Thanks,

-Dan
 
Hello Dan,

Maybe this will work
Code:
ACTION=&quot;javascript:window.location.href=test;&quot;
Richard
 
Try: document.formname.action = test; Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Thanks rac2 and tsdragon for your replies. Tsdragon's response was a winner--it works great. Thanks for your assistance :)

-Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top