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!

two dropdown lists - disable one from the other 2

Status
Not open for further replies.

sickpuppy

Technical User
Feb 22, 2001
40
GB
I am trying to use a form to pass through values to an .asp page.

I have 2 drop down lists and wish for the second to only be selectable depending on the value selected on the first.

Can anyone help?
 
sure:
[tt]
var first = document.forms[0].[firstSelectListName];
var second = document.forms[0].[secondSelectListName];

if (first.selectedIndex == [unacceptableValue]) {
second.disabled = true;
} else {
second.disabled = false;
}
[/tt]




=========================================================
if (!succeed) try();
-jeff
 
function onOff(s) {
if (!s.options[0].selected)
document.f1.s2.disabled = true
else
document.f1.s2.disabled = false
}

<form name=&quot;f1&quot;>
<select name=&quot;s1&quot; onchange=&quot;onOff(this)&quot;>
<option>2nd ON <!-- the 1st option should enable 2nd select list -->
<option>
. . .

<select name=&quot;s2&quot;>
 
Setting the value of disabled = true or false doesn't work in Netscape, though. Anybody has any solution for this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top