Check it Out ! ! !

Hi all,

I have a drop down list in which when items selected it should enable or disable other drop down boxes accordingly..

My problem is,

when i submit the form after selecting it i couldnt get values from those fields...

help me out .

<script type="text/javascript">

window.onload = function()

{

var f, els;

if (f = document.forms[0])

{

f.elements.s2.disabled =true;

f.elements.s1.onchange = function()

{

this.form.elements.s2.disabled = (this.value !='client');

}

f.elements.s1.onchange();

}

}

</script>

<select name="s1" size="1">

<option value="client">client</option>

<option value="purchase">purchase</option>

</select>

<select size="1" name="s2">

<option selected="selected">-choose-</option>

<option >1</option>

<option >2</option>

<option >3</option>

</select>

[1541 byte] By [a1ba] at [2007-11-27 1:25:59]
# 1
Duplicate thread: http://forum.java.sun.com/thread.jspa?threadID=5161958&tstart=0 Please ignore it.
BalusCa at 2007-7-12 0:19:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
tell your problm in detail..where r u stucking?
chahalkhushwindera at 2007-7-12 0:19:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Thanks for ur reply,For the above code when i select client in first drop down,it enables the next drop down otherwise disables..There no prob.But i couldnt get the value .ie, s1 is null (not client or purchase ) and s2 is null (not 1 or 2 or 3) when i select and submit..
a1ba at 2007-7-12 0:19:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

It works for me in IE and FireFox

<html>

<head></head>

<script type="text/javascript">

window.onload = function() {

alert("X");

var f, els;

if (f = document.forms[0]) {

f.elements.s2.disabled = true;

f.elements.s1.onchange = function() {

this.form.elements.s2.disabled = (this.value != 'client');

}

f.elements.s1.onchange();

}

}

</script>

<body>

<form method="GET">

<select name="s1" size="1">

<option value="client">client</option>

<option value="purchase">purchase</option>

</select>

<select size="1" name="s2">

<option selected="selected">-choose-</option>

<option >1</option>

<option >2</option>

<option >3</option>

</select>

<input type=submit name=sub value=sub>

</form>

</body>

</html>

tolmanka at 2007-7-12 0:19:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Ya Thankkkkss..Now i can get values.The problem is i used upper case for s1 and s2.When i change to lower case its working.
a1ba at 2007-7-12 0:19:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...