Page 1 of 1
enable and disable drop down list in php/javascript
Posted: Sat Feb 19, 2005 10:00 am
by ananth_ak
hi,
i'm trying to do enable and disable on two drop down lists,
where initially combo1 is enabled and combo2 is disabled
once selection has been made in combo1, combo2 is enabled..
is there any php/html/javascript solutions for this?
Posted: Sat Feb 19, 2005 10:18 am
by hawleyjr
untested....
Code: Select all
<script language="e;JavaScript"e;>
function enableformObj(formObjName){
document.getElementById(formObjName).disabled = false;
}
</script>
<select name="e;list1"e; onBlur="e;enableformObj('list2');"e;>
<option value="e;1"e;>1</option>
<option value="e;2"e;>2</option>
<option value="e;3"e;>3</option>
</select><select name="e;list2"e; id="e;list2"e; disabled>
<option value="e;a"e;>a</option>
<option value="e;b"e;>b</option>
<option value="e;c"e;>c</option>
</select>
Posted: Sat Feb 19, 2005 10:51 am
by ananth_ak
hi, thanks for the solution.
it works only when you double click. cant see where in the script i can change it to a single click.
Posted: Sat Feb 19, 2005 10:53 am
by ananth_ak
It's alright i found it.
onChange instead of onBlur
<select name="list1" onChange="enableformObj('list2');">
thanks very much!
Posted: Sat Feb 19, 2005 10:54 am
by hawleyjr
Posted: Sat Feb 19, 2005 1:31 pm
by John Cartwright
Moved to Client-Side
Posted: Tue Mar 22, 2005 8:54 am
by ananth_ak
hi,
now that i have one enabled drop down and one disabled drop down
how do i bring up a list of items in the second drop down box based on a selection from the first drop down box.
if drop box 1 = A
then drop box 2 = 1,2,3,4
or
if box 1 = B
then box 2 = 5,6,7,8
Posted: Tue Mar 22, 2005 9:12 am
by CoderGoblin
There is a tutorial for this at
viewtopic.php?t=29084
If you have any comments on the tutorial let me know (possibly private message) as so far no feedback has been received.