Hey everybody
So I created a dropbox that would only enable certain entries in a second dropbox when specific options in the first dropbox are selected.
For example, if A is selected in dropbox 1, then Z and X will be available for selection in dropbox 2, whereas if B is selected in dropbox 1, then xyz and zyx will be available for selection in dropbox 2.
Everything was going fine until I got past my 3rd entry, in which case no matter what I put in dropbox 1 (except for the first 3 entries), nothing appears in dropbox 2.
There appears to be no problem in the code either...
What do you think is the reason behind this?
Thanks in advance for anybody willing to actually respond to me for once...

Recommended Answers

All 7 Replies

I may have to ask you to post your code snippet where you add/remove/change the content of your dropbox2 when a choice in dropbox1 is selected?

Could I perhaps send you the code via PM?
Or I could post it here...
Sorry, I am not on the computer with the code for the dropbox but I will be later tonight and I can do whatever...Thanks

You could post it here withing the 'code' block because other people may catch up on it and help you before I do.

Thanks.
Below is my javascript, followed by my html which comes later for the dropboxes.

<Script Language="JavaScript">
function setOptions(chosen) {
var selbox = document.exform.dropdown1;

selbox.options.length = 0;
if (chosen == " ")
{
selbox.options[selbox.options.length] = new Option('Sub Area',' ');
}
if (chosen == "1")
{
selbox.options[selbox.options.length] = new Option('1','1');
selbox.options[selbox.options.length] = new Option('2','2');
}
if (chosen == "2")
{
selbox.options[selbox.options.length] = new Option('3','3');
selbox.options[selbox.options.length] = new Option('4','4');
}
if (chosen == "3")
{
selbox.options[selbox.options.length] = new Option('3','3');
selbox.options[selbox.options.length] = new Option('4','4');
}
}
if (chosen == "4")
{
selbox.options[selbox.options.length] = new Option('3','3');
selbox.options[selbox.options.length] = new Option('4','4');
}
if (chosen == "5")
{
selbox.options[selbox.options.length] = new Option('3','3');
selbox.options[selbox.options.length] = new Option('4','4');
}

function goConfirm()
{
window.location.href="http://www.google.com"
}

</Script>
</head>
*************************************************************************************
<input type="reset"></center>
</div></form>
<center>
<form name="exform">
<select name="dropdown" size="1" onchange="setOptions(document.exform.dropdown.options[document.exform.dropdown.selectedIndex].value);">
<option value=" " selected="selected">Functional Area</option>
<option value="1">A</option>
<option value="2">A</option>
<option value="3">A</option>
<option value="4">A</option>
<option value="5">B</option>
<option value="6">C</option>
<option value="7">C</option>
<option value="8">C</option>
<option value="9">D</option>
<option value="10">D</option>
<option value="11">D</option>
<option value="12">E</option>
<option value="13">E</option>
<option value="14">F</option>
<option value="15">F</option>
<option value="16">G</option>
<option value="17">G</option>
<option value="18">I</option>
<option value="19">I</option>
<option value="20">L</option>
<option value="21">M</option>
<option value="22">M</option>
<option value="23">M</option>
<option value="24">M</option>
<option value="25">M</option>
<option value="26">M</option>
<option value="27">N</option>
<option value="28">O</option>
<option value="29">P</option>
<option value="30">P</option>
<option value="31">P</option>
<option value="32">R</option>
<option value="33">R</option>
<option value="34">R</option>
<option value="35">R</option>
<option value="36">S</option>
<option value="37">S</option>
<option value="38">S</option>
<option value="39">T</option>
<option value="40">U</option>
<option value="41">W</option>
<option value="42">W</option>
</select>
<select name="dropdown1" size="1">
<option value=" " selected="selected">Sub Area</option>
</select>

<FORM name="Test Type">
<SELECT name="Test Type">
<OPTION SELECTED value="hua.htm">Test Type
<OPTION value="1">Audit
<OPTION value="2">Certification
<OPTION value="3">Drive Test
<OPTION value="4">Ergonomics
<OPTION value="5">Field Test
<OPTION value="6">General
<OPTION value="7">Hardware
<OPTION value="8">Industry Standards
<OPTION value="9">Regulatory
<OPTION value="10">RF
<OPTION value="11">Services
<OPTION value="12">Tools
<OPTION value="13">TPG
</SELECT>
<br>

Did you see that there is an extra '}' in your code right below the 3rd entry?

OMG...WOW...how could I have missed that??? LOL
Thanks so much!
Sometimes it just takes an outside eye to quickly spot the problem...I appreciate your help! :)

You are welcome. Please mark it solved. :)

commented: thanks :) +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.