homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Browsers / Firefox Browser Usage and Support
Forum Library, Charter, Moderators: incrediBILL

Firefox Browser Usage and Support Forum

<option disabled> makes option item disappear

 9:40 am on Feb 17, 2007 (gmt 0)

Hello All -

I've got four dynamically generated select lists on a single page.

From time to time - depending on what's being pulled from the database - one or more of these lists will only show one item, like so:

<form name="foo">
<select name="bar" style="width:130px;">
<option value="S">S</option>

Sometimes, also depending on the state of the database, this single select item may be disabled, like so:

<form name="foo">
<select name="bar" style="width:130px;">
<option value="S" disabled>S</option>

The problem I'm having is that if there's only one item in the select list, and that single item is disabled, the single item doesn't appear.

Now, if I explicitly set the size on the select list to "2" (or more) then the item WILL show up. If I leave out the size attribute, or explicitly set it to "1" still no item.

The same thing happens in Opera and Netscape. Since this is happening in compliant browsers, I'm thinking that I'm the one who's mis-coding this attribute.

Can someone tell me how to solve this?

All assistance greatly appreciated,




 2:11 am on Feb 28, 2007 (gmt 0)

Sorry it took so long to reply, neophyte.

When you say "disappear", do you mean that it does not show up as the default option in the drop-down box, like it does when the item is not disabled?

If so, this is logical in that when the item is not disabled and it is the only option, the browser will select it by default. However if the item is disabled, there is no appropriate candidate for selection - hence the blank space and the disabled option below in the drop-down.

Note that IE doesn't properly support the disabled attribute on the option element.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Browsers / Firefox Browser Usage and Support
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved