By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,673 Members | 1,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,673 IT Pros & Developers. It's quick & easy.

Disabling parts of a select

P: n/a
Am I right in thinking that while I can disable a select, I can't
disable the <option>s within the select?

I think this is the case but would like to be sure.

Thanks,

-- tim
Jan 31 '07 #1
Share this Question
Share on Google+
11 Replies

P: n/a
Tim Streater wrote:
>
Am I right in thinking that while I can disable a select, I can't
disable the <option>s within the select?

I think this is the case but would like to be sure.
According to MSDN HTML reference, for the "disabled" attribute/property:
"...For OPTGROUP and OPTION, the functionality specified by the HTML
4.0 standard is not currently implemented..."
Jan 31 '07 #2

P: n/a
In article <45***************@thelogconnection.com>,
Gary Hasler <ga********@thelogconnection.comwrote:
Tim Streater wrote:

Am I right in thinking that while I can disable a select, I can't
disable the <option>s within the select?

I think this is the case but would like to be sure.

According to MSDN HTML reference, for the "disabled" attribute/property:
"...For OPTGROUP and OPTION, the functionality specified by the HTML
4.0 standard is not currently implemented..."
Thanks. Guess I'll have to leave those items out of the popup then.
Shame, it would have been useful for them to be there, but dimmed and
unselectable.

-- tim
Feb 1 '07 #3

P: n/a
* Tim Streater wrote:
Am I right in thinking that while I can disable a select, I can't
disable the <option>s within the select?

I think this is the case but would like to be sure.
If you don't want them to be selectable don't put them in a select box.
You could have two select boxes one showing selected items one showing
unselected items. Then a button to copy from one select to the other
(add/remove) Seem familiar? :-D It's trivial to do in JavaScript.
Feb 1 '07 #4

P: n/a
In article <ep**********@custnews.inweb.co.uk>,
John Smith <jo*********@zxlj1.comwrote:
* Tim Streater wrote:
Am I right in thinking that while I can disable a select, I can't
disable the <option>s within the select?

I think this is the case but would like to be sure.

If you don't want them to be selectable don't put them in a select box.
You could have two select boxes one showing selected items one showing
unselected items. Then a button to copy from one select to the other
(add/remove) Seem familiar? :-D It's trivial to do in JavaScript.
Hmm this is waht happens when one posts with no context. The user of the
select might wonder why the option they want doesn't appear in the
select. The reason will be because they didn't enter an item in the
database correctly, elsewhere. I want the item to be visible but not
selectable. Then I can have a note saying telling them why this is. Its
a visual clue to the user.

-- tim
Feb 1 '07 #5

P: n/a
"Tim Streater" <ti**********@dante.org.ukwrote in message
news:ti********************************@individual .net...
In article <ep**********@custnews.inweb.co.uk>,
John Smith <jo*********@zxlj1.comwrote:
>* Tim Streater wrote:
Am I right in thinking that while I can disable a select, I can't
disable the <option>s within the select?

I think this is the case but would like to be sure.

If you don't want them to be selectable don't put them in a select box.
You could have two select boxes one showing selected items one showing
unselected items. Then a button to copy from one select to the other
(add/remove) Seem familiar? :-D It's trivial to do in JavaScript.

Hmm this is waht happens when one posts with no context. The user of the
select might wonder why the option they want doesn't appear in the
select. The reason will be because they didn't enter an item in the
database correctly, elsewhere. I want the item to be visible but not
selectable. Then I can have a note saying telling them why this is. Its
a visual clue to the user.
So use JavaScript to write out your selects and then populate some list with disabled
options with your reasons stated near it.

-Lost
Feb 1 '07 #6

P: n/a
Tim Streater wrote:
>
In article <ep**********@custnews.inweb.co.uk>,
John Smith <jo*********@zxlj1.comwrote:
* Tim Streater wrote:
Am I right in thinking that while I can disable a select, I can't
disable the <option>s within the select?
>
I think this is the case but would like to be sure.
If you don't want them to be selectable don't put them in a select box.
You could have two select boxes one showing selected items one showing
unselected items. Then a button to copy from one select to the other
(add/remove) Seem familiar? :-D It's trivial to do in JavaScript.

Hmm this is waht happens when one posts with no context. The user of the
select might wonder why the option they want doesn't appear in the
select. The reason will be because they didn't enter an item in the
database correctly, elsewhere. I want the item to be visible but not
selectable. Then I can have a note saying telling them why this is. Its
a visual clue to the user.

-- tim
You know, now that I think about it, I have seen popup lists where some
options are either disabled, or in a different color, or had a different
background...can't remember where or when or how it was done. If you
could at least give them a different color or font weight--maybe using
styles--then if they choose one of the invalid options you could pop up
a warning that they have to change it?...
Feb 1 '07 #7

P: n/a
"Gary Hasler" <ga********@thelogconnection.comwrote in message
news:45***************@thelogconnection.com...
Tim Streater wrote:
>>
In article <ep**********@custnews.inweb.co.uk>,
John Smith <jo*********@zxlj1.comwrote:
* Tim Streater wrote:
Am I right in thinking that while I can disable a select, I can't
disable the <option>s within the select?

I think this is the case but would like to be sure.

If you don't want them to be selectable don't put them in a select box.
You could have two select boxes one showing selected items one showing
unselected items. Then a button to copy from one select to the other
(add/remove) Seem familiar? :-D It's trivial to do in JavaScript.

Hmm this is waht happens when one posts with no context. The user of the
select might wonder why the option they want doesn't appear in the
select. The reason will be because they didn't enter an item in the
database correctly, elsewhere. I want the item to be visible but not
selectable. Then I can have a note saying telling them why this is. Its
a visual clue to the user.

-- tim

You know, now that I think about it, I have seen popup lists where some
options are either disabled, or in a different color, or had a different
background...can't remember where or when or how it was done. If you
could at least give them a different color or font weight--maybe using
styles--then if they choose one of the invalid options you could pop up
a warning that they have to change it?...
http://www.lattimore.id.au/2005/06/1...pdown-element/

Of course, do not expect Internet Explorer to play along. As stated in the article, "the
IE team" implemented the "disabled" attribute for the select itself, but not its options.

You can visit the first link on that page which gives Internet Explorer a JavaScript
alternative. It "fakes" it rather nicely by switching your choice if you choose one of
its grayed options.

-Lost
Feb 2 '07 #8

P: n/a
Gary Hasler wrote:
>
...snip..
>
You know, now that I think about it, I have seen popup lists where some
options are either disabled, or in a different color, or had a different
background...can't remember where or when or how it was done. If you
could at least give them a different color or font weight--maybe using
styles--then if they choose one of the invalid options you could pop up
a warning that they have to change it?...
Hey it works; at least in IE6. Create a style, eg:
<style type="text/css">
option.forbid { color: #888; }
</style>

then have your script write the "disabled" options as:
<OPTION value='foo' class="forbid" >

They can still choose them, but you can handle that however you think
best.
Feb 2 '07 #9

P: n/a
On Feb 1, 4:49 pm, Gary Hasler <garyhas...@thelogconnection.com>
wrote:
Gary Hasler wrote:

..snip..
You know, now that I think about it, I have seen popup lists where some
options are either disabled, or in a different color, or had a different
background...can't remember where or when or how it was done. If you
could at least give them a different color or font weight--maybe using
styles--then if they choose one of the invalid options you could pop up
a warning that they have to change it?...

Hey it works; at least in IE6. Create a style, eg:
<style type="text/css">
option.forbid { color: #888; }
</style>

then have your script write the "disabled" options as:
<OPTION value='foo' class="forbid" >

They can still choose them, but you can handle that however you think
best.
This is certainly a hack, but you can use the optgroup html element:
<optgroup label="not selectable"></optgroup>

Feb 2 '07 #10

P: n/a
In article <45***************@thelogconnection.com>,
Gary Hasler <ga********@thelogconnection.comwrote:
Gary Hasler wrote:
..snip..

You know, now that I think about it, I have seen popup lists where some
options are either disabled, or in a different color, or had a different
background...can't remember where or when or how it was done. If you
could at least give them a different color or font weight--maybe using
styles--then if they choose one of the invalid options you could pop up
a warning that they have to change it?...

Hey it works; at least in IE6. Create a style, eg:
<style type="text/css">
option.forbid { color: #888; }
</style>

then have your script write the "disabled" options as:
<OPTION value='foo' class="forbid" >

They can still choose them, but you can handle that however you think
best.
Yes, something like this might be the way to go. The popup is created
with PHP but it could colour the illegal ones red perhaps so some JS
could forbid them subsequently.

Of course, in the meantime I've just removed those ones from being in
the popup and I'm working on something else now. :-)

Thanks for the input.

-- tim
Feb 2 '07 #11

P: n/a
"Tim Streater" <ti**********@dante.org.ukwrote in message
news:ti********************************@individual .net...
In article <45***************@thelogconnection.com>,
Gary Hasler <ga********@thelogconnection.comwrote:
>Gary Hasler wrote:
..snip..
>
You know, now that I think about it, I have seen popup lists where some
options are either disabled, or in a different color, or had a different
background...can't remember where or when or how it was done. If you
could at least give them a different color or font weight--maybe using
styles--then if they choose one of the invalid options you could pop up
a warning that they have to change it?...

Hey it works; at least in IE6. Create a style, eg:
<style type="text/css">
option.forbid { color: #888; }
</style>

then have your script write the "disabled" options as:
<OPTION value='foo' class="forbid" >

They can still choose them, but you can handle that however you think
best.

Yes, something like this might be the way to go. The popup is created
with PHP but it could colour the illegal ones red perhaps so some JS
could forbid them subsequently.

Of course, in the meantime I've just removed those ones from being in
the popup and I'm working on something else now. :-)
Um... did you even look at that article I posted?

-Lost
Feb 2 '07 #12

This discussion thread is closed

Replies have been disabled for this discussion.