HighDots Forums  

How do I disable the dropdwon button on a SELECT element

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss How do I disable the dropdwon button on a SELECT element in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jack
 
Posts: n/a

Default How do I disable the dropdwon button on a SELECT element - 11-20-2005 , 09:40 PM






Hi, all

I would like to disable the dropdowm function on a SELECT element. I tried
"disabled", it works but it becomes dim. I tried readonly, it won't work. I
tried "onmousedown='return false' " , it won't work. Please advise how to
disable it? Thank you very much!

Jack



Reply With Quote
  #2  
Old   
Kimmo Laine
 
Posts: n/a

Default Re: How do I disable the dropdwon button on a SELECT element - 11-21-2005 , 12:31 AM






"Jack" <jack2005 (AT) tpg (DOT) com.au> wrote

Quote:
Hi, all

I would like to disable the dropdowm function on a SELECT element. I tried
"disabled", it works but it becomes dim. I tried readonly, it won't work.
I
tried "onmousedown='return false' " , it won't work. Please advise how to
disable it? Thank you very much!


Why would you want to do that? The only function of a dropdown menu is
dropping down, and you want to disable that? Then why have the control in
the first place? What does it matter if it goes dim if you disable it? This
is just so odd question...

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
antaatulla.sikanautaa (AT) gmail (DOT) com.NOSPAM.invalid




Reply With Quote
  #3  
Old   
Jack
 
Posts: n/a

Default Re: How do I disable the dropdwon button on a SELECT element - 11-21-2005 , 12:40 AM



Thank you for reply. I just want the Select element to work a readonly
field.

Jack


"Kimmo Laine" <antaatulla.sikanautaa (AT) gmail (DOT) com.NOSPAM.invalid> wrote in
message news:eVdgf.11520$OT7.6360 (AT) reader1 (DOT) news.jippii.net...
Quote:
"Jack" <jack2005 (AT) tpg (DOT) com.au> wrote in message
news:438141b2$1 (AT) dnews (DOT) tpgi.com.au...
Hi, all

I would like to disable the dropdowm function on a SELECT element. I
tried
"disabled", it works but it becomes dim. I tried readonly, it won't
work.
I
tried "onmousedown='return false' " , it won't work. Please advise how
to
disable it? Thank you very much!



Why would you want to do that? The only function of a dropdown menu is
dropping down, and you want to disable that? Then why have the control in
the first place? What does it matter if it goes dim if you disable it?
This
is just so odd question...

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirvi?
antaatulla.sikanautaa (AT) gmail (DOT) com.NOSPAM.invalid





Reply With Quote
  #4  
Old   
mscir
 
Posts: n/a

Default Re: How do I disable the dropdwon button on a SELECT element - 11-21-2005 , 03:05 AM



Jack wrote:
Quote:
Thank you for reply. I just want the Select element to work a readonly
field.

Jack
1. went to google

http://www.google.com/search?hl=en&q...=Google+Search

2. quickly scanned 1st pg of hits

http://www.mredkj.com/tutorials/tutorial001.html


Reply With Quote
  #5  
Old   
Kimmo Laine
 
Posts: n/a

Default Re: How do I disable the dropdwon button on a SELECT element - 11-21-2005 , 03:28 AM



"Jack" <jack2005 (AT) tpg (DOT) com.au> wrote

Quote:
Thank you for reply. I just want the Select element to work a readonly
field.

Okay... so why the select? Why not a readonly text input? Like so: <input
type="text" readonly>

A select that user can't select serves no purpouse, if you ask me. I'd still
like to hear a bit more of the situation, so that I might understund what
you want. Well, I've heard _what_ you want, but I still don't know _why_ you
want that... You obviously have a perfectly good reason.

Since html4.01 specification does not define readonly for select element,
the closest you can achieve is something like this:
<select name="select" onChange="this.selectedIndex=0;">
<option>one</option>
<option>two</option>
</select>

The user may select something from the list, but js forces it to select 0
regardless of what user selected. Now, this again has no effect at all if I
turn off javascript, so it has no significant value. Disabling the select is
the fool-proof method, but apparently it's not what you wanted.

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviö
antaatulla.sikanautaa (AT) gmail (DOT) com.NOSPAM.invalid




Reply With Quote
  #6  
Old   
Jack
 
Posts: n/a

Default Re: How do I disable the dropdwon button on a SELECT element - 11-21-2005 , 08:31 AM



My point is I would like to show the information comes from a sql database
in a form to remind user when filling the form. While the information is
just a code, so I setup the SELECT OPTION with Value=code and description on
OPTION text. Such as
<OPTION value="code1">description1
<OPTION value="code2">description2
....
Then users just see the description instead of the code.


Jack

"Kimmo Laine" <antaatulla.sikanautaa (AT) gmail (DOT) com.NOSPAM.invalid> wrote in
message news:qvggf.11563$aF.788 (AT) reader1 (DOT) news.jippii.net...
Quote:
"Jack" <jack2005 (AT) tpg (DOT) com.au> wrote in message
news:43816bd6$1 (AT) dnews (DOT) tpgi.com.au...
Thank you for reply. I just want the Select element to work a readonly
field.


Okay... so why the select? Why not a readonly text input? Like so: <input
type="text" readonly

A select that user can't select serves no purpouse, if you ask me. I'd
still
like to hear a bit more of the situation, so that I might understund what
you want. Well, I've heard _what_ you want, but I still don't know _why_
you
want that... You obviously have a perfectly good reason.

Since html4.01 specification does not define readonly for select element,
the closest you can achieve is something like this:
select name="select" onChange="this.selectedIndex=0;"
option>one</option
option>two</option
/select

The user may select something from the list, but js forces it to select 0
regardless of what user selected. Now, this again has no effect at all if
I
turn off javascript, so it has no significant value. Disabling the select
is
the fool-proof method, but apparently it's not what you wanted.

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirvi?
antaatulla.sikanautaa (AT) gmail (DOT) com.NOSPAM.invalid





Reply With Quote
  #7  
Old   
Jack
 
Posts: n/a

Default Re: How do I disable the dropdwon button on a SELECT element - 11-21-2005 , 08:10 PM



Thank you for the hint. At the moment, I do like this:
<select name="select" onFocus="zzj=this.selectedIndex"
onchange="this.selectedIndex=zzj">


Jack

"Kimmo Laine" <antaatulla.sikanautaa (AT) gmail (DOT) com.NOSPAM.invalid> wrote in
message news:qvggf.11563$aF.788 (AT) reader1 (DOT) news.jippii.net...
Quote:
"Jack" <jack2005 (AT) tpg (DOT) com.au> wrote in message
news:43816bd6$1 (AT) dnews (DOT) tpgi.com.au...
Thank you for reply. I just want the Select element to work a readonly
field.


Okay... so why the select? Why not a readonly text input? Like so: <input
type="text" readonly

A select that user can't select serves no purpouse, if you ask me. I'd
still
like to hear a bit more of the situation, so that I might understund what
you want. Well, I've heard _what_ you want, but I still don't know _why_
you
want that... You obviously have a perfectly good reason.

Since html4.01 specification does not define readonly for select element,
the closest you can achieve is something like this:
select name="select" onChange="this.selectedIndex=0;"
option>one</option
option>two</option
/select

The user may select something from the list, but js forces it to select 0
regardless of what user selected. Now, this again has no effect at all if
I
turn off javascript, so it has no significant value. Disabling the select
is
the fool-proof method, but apparently it's not what you wanted.

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirvi?
antaatulla.sikanautaa (AT) gmail (DOT) com.NOSPAM.invalid





Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.