Hello All,
I am in need of some debugging assistance. I have been working with this
script that will allow me to select a navigational jump from the combination
of 2 drop down menus. Ah but theres a twist, isn't there always in this
business, it needs to have the options of the second drop be dependant on
what was selected in the first. I've been able to do this kinda, but I have
found a couple of bugs and I don't know where else to turn.
Bug 1 (these are not in any real order)
If you select a combination and submit it and arrive at your selected page
and then for some reason you decide to click the back button to go back to
select a different combination you see that the combination you selected
before is messed up. The option in the first drop is still selected but the
contents of the second drop are missing. In their place is a blank selection
box with nothing to select. If you select a different option in the first
box and then return to your first selection the contents of the second drop
return. There has to be a way to fix this so that the options are always
visible and selectable.
Bug 2
I have added some basic error handling to correct if someone selects an
option from the first drop but does not select an option from the second
option before they hit the submit button and receive an error message alert
box. This works fine but I am finding that the page refreshes itself after I
click ok on the alert box. I tried to correct this by adding:
TermProgram = "Yes"
if (TermProgram == "Yes"){return false}
it did stop the page from refreshing but it also stopped the drop down
navigation jump to work too. Any ideas?
Bug 3
This isn't really a bug but a question. After you select your combination
and go to the page you wanted to reach the path in the address bar shows the
field names and the values within it. Is there a way to hide this?
I know this is a lot but I'm stuck and I'm running out of time to get this
project done.
<% Option Explicit %>
<% Response.Buffer = true %>
<html>
<head>
<title>HP Cleaning Kit Program</title>
<style rolloverstyle>A:hover {color: #FF9900}
</style>
<script language="Javascript">
function SelCountryLang(Field)
{
var CountrySel=Field.options[Field.selectedIndex].value
var LangSel = document.forms[0].language
if(CountrySel == " ")
{
LangSel.options.length = 0
LangSel.options[0] = new Option("Select A Language" , "00")
}
if(CountrySel == "Arg")
{
LangSel.options.length = 0
LangSel.options[0] = new Option("Select A Language" , "00")
LangSel.options[1] = new Option("Spanish" , "02")
LangSel.options[2] = new Option("English" , "01")
}
if(CountrySel == "Bzl")
{
LangSel.options.length = 0
LangSel.options[0] = new Option("Select A Language" , "00")
LangSel.options[1] = new Option("Portuguese" , "04")
LangSel.options[2] = new Option("Spanish" , "02")
LangSel.options[3] = new Option("English" , "01")
}
if(CountrySel == "Chl")
{
LangSel.options.length = 0
LangSel.options[0] = new Option("Select A Language" , "00")
LangSel.options[1] = new Option("Spanish" , "02")
LangSel.options[2] = new Option("English" , "01")
}
if(CountrySel == "Col")
{
LangSel.options.length = 0
LangSel.options[0] = new Option("Select A Language" , "00")
LangSel.options[1] = new Option("Spanish" , "02")
LangSel.options[2] = new Option("English" , "01")
}
if(CountrySel == "Peru")
{
LangSel.options.length = 0
LangSel.options[0] = new Option("Select A Language" , "00")
LangSel.options[1] = new Option("Spanish" , "02")
LangSel.options[2] = new Option("English" , "01")
}
if(CountrySel == "Ven")
{
LangSel.options.length = 0
LangSel.options[0] = new Option("Select A Language" , "00")
LangSel.options[1] = new Option("Spanish" , "02")
LangSel.options[2] = new Option("English" , "01")
}
Quote:
}
function SelDestination(Form)
{
var CountrySel =
Form.country.options[Form.country.options.selectedIndex].value
var LangSel =
Form.language.options[Form.language.options.selectedIndex].value
if (CountrySel == " " && LangSel == "00" )
{alert("You need to select a Country and Language before you can
proceed")}
if (CountrySel == "Arg" && LangSel == "00" )
{alert("You need to select a language before you can proceed") ;
TermProgram = "Yes"}
if (CountrySel == "Arg" && LangSel == "02" )
{document.forms[0].action = "../argentina/" ; TermProgram = "Yes"}
if (CountrySel == "Arg" && LangSel == "01" )
{document.forms[0].action = "../argentina/" ; TermProgram = "Yes"}
if (CountrySel == "Bzl" && LangSel == "00" )
{alert("You need to select a language before you can proceed")}
if (CountrySel == "Bzl" && LangSel == "04" )
{document.forms[0].action = "../brazil/"}
if (CountrySel == "Bzl" && LangSel == "02" )
{document.forms[0].action = "../brazil/"}
if (CountrySel == "Bzl" && LangSel == "01" )
{document.forms[0].action = "../brazil/"}
if (CountrySel == "Chl" && LangSel == "00" )
{alert("You need to select a language before you can proceed")}
if (CountrySel == "Chl" && LangSel == "02" )
{document.forms[0].action = "../chile/"}
if (CountrySel == "Chl" && LangSel == "01" )
{document.forms[0].action = "../chile/"}
if (CountrySel == "Col" && LangSel == "00" )
{alert("You need to select a language before you can proceed")}
if (CountrySel == "Col" && LangSel == "02" )
{document.forms[0].action = "../colombia/"}
if (CountrySel == "Col" && LangSel == "01" )
{document.forms[0].action = "../colombia/"}
if (CountrySel == "Peru" && LangSel == "00" )
{alert("You need to select a language before you can proceed")}
if (CountrySel == "Peru" && LangSel == "02" )
{document.forms[0].action = "../peru/"}
if (CountrySel == "Peru" && LangSel == "01" )
{document.forms[0].action = "../peru/"}
if (CountrySel == "Ven" && LangSel == "00" )
{alert("You need to select a language before you can proceed")}
if (CountrySel == "Ven" && LangSel == "02" )
{document.forms[0].action = "../venezuela/"}
if (CountrySel == "Ven" && LangSel == "01" )
{document.forms[0].action = "../venezuela/"}
// if(TermProgram == "Yes"){return false}
Quote:
}
</script>
</head>
<body>
<form action onSubmit="return SelDestination(this)">
<select size="1" name="country" onChange="SelCountryLang(this)">
<option value=" " selected>Select Your Country</option>
<option value="Arg">Argentina</option>
<option value="Bzl">Brazil</option>
<option value="Chl">Chile</option>
<option value="Col">Colombia</option>
<option value="Peru">Peru</option>
<option value="Ven">Venezuela</option>
</select>
?
<select size="1" name="language">
<option value="00" selected>Select A Language</option>
</select>
<input type="submit" value="Submit" name="submit">
</form>
</body>
</html>