Forum Moderators: open

Message Too Old, No Replies

Disabled select box is not Posting Value

select box which disabled in form not posting the value

         

ravi

1:47 pm on Mar 31, 2009 (gmt 0)

10+ Year Member



Hi,

I have created the select box(combo box) in disabled mode.

I have made the default one value as "selected".

When i tried to submit the form,the disabled select box value is not posted(get/POST).

<form action="">
<select name="sample" >
<option value="testing" selected>Testing</option>
<option value="testing2">Testing2</option>
</select>
<input type="submit" name="but"/>
</form>

I would like to submit the form with the value of that combo box which is disabled mode.

Help me to fix this issue.
Thanks
ravi

budoink

3:51 pm on Mar 31, 2009 (gmt 0)

10+ Year Member



i've worked around this problem in the past by using javacript to enable the combo box on submission


<script>
function enableSample() {
document.getElementById('sample').disabled=false;
}
</script>
<form action="" onsubmit="enableSample();"
<select name="sample" id="sample">
<option value="testing" selected>Testing</option>
<option value="testing2">Testing2</option>
</select>
<input type="submit" name="but"/>
</form>

hope that helps

ravi

5:58 am on Apr 1, 2009 (gmt 0)

10+ Year Member



Thanks budoink

Great.It is fixed.

Thanks for ur help.
by
ravi