...

View Full Version : Disable drop down



florida
01-21-2009, 12:34 AM
I have 2 drop downs where I want the second one to be disabled. It will only be enabled after the first drop down has been selected.

Here is my attempt but not working because the second drop down is always enabled:

<script>
function enableField()
{
if(document.myname.movie.value != "")
{
document.myname.television.disabled=true;
}
}
</script>


<form name="myname" method="post" action="mypage.jsp">
<select name = "Movie" onselect="enableField()";>
<option value = "">Select One</option>
<option value = "I am Legend">I am Legend</option>
<option value = "Wedding Crashers">Wedding Crashers</option>
<option value = "Jaws">Jaws</option>
</select>

<select name = "Television">
<option value = "">Select One</option>
<option value = "CSI">CSI</option>
<option value = "Amercian Idol">American Idol</option>
<option value = "60 Minutes">60 Minutes</option>
</select>

abduraooft
01-21-2009, 07:35 AM
<script type="text/javascript">
function enableField(obj)
{
if(obj.value != "")
document.myname.Television.disabled=false;
}
</script>

<form name="myname" method="post" action="mypage.jsp">
<select name = "Movie" onchange="enableField(this)";>
<option value = "">Select One</option>
<option value = "I am Legend">I am Legend</option>
<option value = "Wedding Crashers">Wedding Crashers</option>
<option value = "Jaws">Jaws</option>
</select>

<select name = "Television" disabled="disabled">
<option value = "">Select One</option>
<option value = "CSI">CSI</option>
<option value = "Amercian Idol">American Idol</option>
<option value = "60 Minutes">60 Minutes</option>
</select>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum