Click to See Complete Forum and Search --> : drop down menu validation to a redirect URL


Stacey
12-10-2002, 09:06 AM
I have a one drop down menu form with a Yes or No to select. Basically, depending on whether they select Yes or No the user will be redirected to a different page. It seems like it would be so simple but I'm definately missing something and I am no javascript coder so any suggestions would be great!

<SCRIPT LANGUAGE=javascript>
<!--
function sendData()
{
var okToSend = true;

document.frmQuestion.hdnRequestorName.value = "<%=strRequestorName%>";
document.frmQuestion.hdnRequestorPhone.value = "<%=strRequestorPhone%>";
document.frmQuestion.hdnRequestorEmail.value = "<%=strRequestorEmail%>";
document.frmQuestion.hdnRequestType.value = "<%=strRequestType%>";
document.frmQuestion.hdnWebServer.value = "<%=strWebServer%>";
document.frmQuestion.hdnRedirectURL.value = "<%=strRedirectURL%>";


if (document.frmQuestion.selWebServer.selectedIndex == 0)
{
alert ("Please select Yes or No in order to continue.");
document.frmQuestion.selWebServer.focus();
return false;
okToSend = false;
}

//****I know this is wrong but this is the section I'm having trouble with...
if (document.frmQuestion.selWebServer.value = "Yes")
{
strRedirectURL = "webserver.asp"
}
if (document.frmQuestion.selWebServer.value = "No")
strRedirectURL = "oopsie.asp"
}


//document.frmQuestion.action = "getVariableValues.asp";
//document.frmQuestion.action = "testresults.asp";
document.frmQuestion.action = "<%=strRedirectURL%>";
document.frmQuestion.submit();
}
//-->
</SCRIPT>



here is the html drop down menu section...
<table align=center border=2 borderColor=#000000 cellPadding=1 cellSpacing=1 width=400>
<tr><td bgColor="#004A84" borderColor=black>

<p align="center" style="font-size: 12pt; font-weight: bold">
<font color="#FFFFFF" face="Arial">Is this request for a Web Server?</font></td></tr>
<tr><td borderColor=#000000>
<p align="center"><select size="1" name="selWebServer">
<option selected value="Select One:">Select One:</option>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select></td></tr></table>

Stacey
12-10-2002, 09:36 AM
ok, i think i'm a little closer here but still missing something...

<SCRIPT LANGUAGE=javascript>
<!--
function sendData()
{
var okToSend = true;
var RedirectURL = "<%=strRedirectURL%>";
var selWebServer = "<%=strWebServer%>";

document.frmQuestion.hdnRequestorName.value = "<%=strRequestorName%>";
document.frmQuestion.hdnRequestorPhone.value = "<%=strRequestorPhone%>";
document.frmQuestion.hdnRequestorEmail.value = "<%=strRequestorEmail%>";
document.frmQuestion.hdnRequestType.value = "<%=strRequestType%>";
document.frmQuestion.hdnWebServer.value = "<%=strWebServer%>";


if (document.frmQuestion.selWebServer.selectedIndex == 0)
{
alert ("Please select Yes or No in order to continue.");
document.frmQuestion.selWebServer.focus();
return false;
okToSend = false;
}

if (selWebServer == Yes) {
RedirectURL = "webserver.asp";
}
if (selWebServer == No) {
RedirectURL = "oopsie.asp";
}

//document.frmQuestion.RedirectURL.value = "<%=strRedirectURL%>";

//document.frmQuestion.action = "getVariableValues.asp";
//document.frmQuestion.action = "testresults.asp";
document.frmQuestion.action = "<%=strRedirectURL%>";
document.frmQuestion.submit();
}
//-->
</SCRIPT>