473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Disabling parts of a select

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
11 1656
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
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
* 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
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
"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
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
"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
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
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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Old Lady | last post by:
Hi, I need help! I have a SELECT/OPTION list. My goal is to have a TEXT input field in a form that is normally disabled, but it should become enabled when the user select one predefined OPTION....
12
by: Nalaka | last post by:
Hi, I suddenly started getting a lot of errors from html validation (some CSS) so I followed the following instructions to disable it. If you'd rather not have these types of HTML validation...
1
by: kebabkongen | last post by:
Hi, I'm working on a JavaScript that is enabling / disabling a select element according to whether a checkbox is selected or not. This works fine in Firefox, but in Internet Explorer (v 6.0.2900)...
3
by: Rick | last post by:
I have a customer order form with a subform that lists parts per customer order that I'm updating. I'm trying to filer the parts list per Manufacture and Model number so that the user doesn't have...
0
by: Hvid Hat | last post by:
Hi At first, I thought I could only solve my problem with a C# method inside my XSLT but I'm beginning to think it might be possible with XSLT only. So I'm trying, but I need help :-) How can I...
92
by: bonneylake | last post by:
Hey Everyone, Well i was hoping someone could explain the best way i could go about this. i have a few ideas on how i could go about this but i am just not sure if it would work. Right now i...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
1
by: thesti | last post by:
hello, i need to validate birthday using javascript. the validation is that for example user couldn't choose the date 29, 30 and 31 if she has chosen February as the month before and the year % 4...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.