Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Getting the value of a disabled <select> control

Reply
Thread Tools

Getting the value of a disabled <select> control

 
 
Eric
Guest
Posts: n/a
 
      11-02-2007
Hello,

I'm trying (without any success) to get the value of a disabled select
control. From reviewing:

http://www.w3.org/TR/html401/interac...#adef-disabled

It doesn't sound like it's going to be possible directly. I'm
thinking that I can get around it by enabling the select control
during some javascript that gets executed during the submit.

-Eric

 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      11-02-2007
Eric wrote on 02 nov 2007 in microsoft.public.inetserver.asp.general:

> Hello,
>
> I'm trying (without any success) to get the value of a disabled select
> control. From reviewing:
>
> http://www.w3.org/TR/html401/interac...#adef-disabled
>
> It doesn't sound like it's going to be possible directly. I'm
> thinking that I can get around it by enabling the select control
> during some javascript that gets executed during the submit.



Works fine here [IE7,FF2]:

<select id='a' disabled>
<option value='1'>1</option>
<option value='2' selected>2</option>
<option value='3'>4</option>
</select>

<script type='text/javascript'>

alert(document.getElementById('a').value) // shows 2

</script>



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      11-03-2007
Eric wrote:
> Hello,
>
> I'm trying (without any success) to get the value of a disabled select
> control.


I'm assuming you want the value in the form's submission.

> From reviewing:
>
> http://www.w3.org/TR/html401/interac...#adef-disabled
>
> It doesn't sound like it's going to be possible directly.


Right
> I'm
> thinking that I can get around it by enabling the select control
> during some javascript that gets executed during the submit.
>

Either that or use client-side script in the onsubmit event to put the value
in a hidden textbox in the form.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Https website - security popup not getting disabled - page has a s Suba ASP .Net 0 04-23-2008 08:02 PM
Sometimes IE's Back Button is getting disabled in ASP.NET Page with few .Net Controls. NH ASP .Net Web Controls 0 08-18-2004 03:05 PM
Sometimes IE's Back Button is getting disabled in ASP.NET Page with few .Net Controls. NH ASP .Net 0 08-18-2004 03:05 PM
Retrieve value from hidden/disabled DropDownList? Cipher ASP .Net 1 07-11-2004 03:52 AM
Checkbox returns wrong value when disabled Paul ASP .Net 1 08-27-2003 11:57 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57