Jump to content

insane option tag!?!?!?


shindasingh

Recommended Posts

Been messing with this for the longest time now, but for some reason IE (6.0+) doesn't seem to support the disabled attribute.

ie...



<select name="test" size="1">


<option value="1">check12</option>


<option disabled value="2">check122</option>


<option value="3" DISABLED>check324</option>


<option value="4" DISABLED="true">123</option>


<option value="5" disabled="true">23</option>


<option value="6" disabled="disabled">532</option>


<option value="7" >=</option>


</select>

I've tried almost every combination I can think of, and read off, but nothing seems to be working.

Any idea on whats up or where I'm messing up??

Funny thing is just "disabled" in the tag alone before "used" to work, but alass no more..

Link to comment
Share on other sites

what are u trying to do?... (not that i'd know the answer!)

Basically disable an item (option) in a list box.

You get a list you get a bunch of options...Just want to disable some. (Prevent clicking on it etc). It could be argued that the problem is just as easily solved by not listing the item/option, but thats not really what I want accomplished.

Problem can be solved using java script and I may end up going to java script as a last resort, but would rather figure out why this simple attribute isn't working.

Link to comment
Share on other sites

You get a list you get a bunch of options...Just want to disable some. (Prevent clicking on it etc). It could be argued that the problem is just as easily solved by not listing the item/option, but thats not really what I want accomplished.

Errm yeah it defeats the purpose.

Isn't that code for drop-down as oppose to list box?

Link to comment
Share on other sites

I donno about beore but i just created a test html page and used different target schemas and non of them seem to have the Attribute Disabled for a listbox. The only one supported is

<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

when i added that, there was an attribute available in the <select> tag but not in the option tag.

A way around the situation is to

make a css style which makes the items you want to disable "lighter in font than the other items.

<OPTION value="Item1" class="disabled">Item1</OPTION>

Then in your javascript function, ignore any item that is disabled, you can do that by setting the VAlue of the item to "Disabled" and then in the javascript function ignore any item that has a value of "Disabled"

it will work the same way, as if you had disabled some of the items in the list box and not the others. I know its a way around, but i couldnt find any other schemas that support "Disabled" attribute.

btw, i use Microsoft visual studio .net 2004 and it supports intellisence which basically means that as soon as i start a tag <select , it gives me all available attributes for that tag depending on the target schema of the document :)
Link to comment
Share on other sites

Yea, I guess its more work then I really wanted to put in. I read up on some other forums, and it would seem that IE doesn't support it and I was just getting confused since I use Opera and IE interchangablly. (In Opera the attribute works perfectly.)

Then in your javascript function, ignore any item that is disabled, you can do that by setting the VAlue of the item to "Disabled" and then in the javascript function ignore any item that has a value of "Disabled"

I was affraid of this :roll:

Either way thanks for all the help.

And for those interested here are the links to the other forum in regards to this...

http://forums.devshed.com/t67144/s.html&hi...=disable+option

http://forums.devshed.com/t119291/s.html&h...=disable+option

Link to comment
Share on other sites

damnit! Singh beat me to it :x

I was going to say the same thing, I doubt it if you can do this plain and simple HTML way. You have to use Java, not that difficult, just have to define one function...easier if you got ASP.net

It was a good question though, had me thinking :wink:

Link to comment
Share on other sites

damnit! Singh beat me to it :x

I was going to say the same thing, I doubt it if you can do this plain and simple HTML way. You have to use Java, not that difficult, just have to define one function...easier if you got ASP.net

It was a good question though, had me thinking :wink:

:bravo: ASP.net all the way. Sasha if you do, do ASP.net then check out these controls, they are way cool.

http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx

Demo

http://www.metabuilders.com/Tools/DialogWindow.aspx

Basically , you can truly use the ASp.net webforms as FORMS, instead of webpages with these controls. I am using them on a project i been doing. 8)

I love ASp.net to bits, but hate web development. More of a windows guy. In ASp.net you could inherit from the Listbox class and create your own control, with custom properties and functionality.

Link to comment
Share on other sites

*guv nods head & pretends he knows what everyones talking about*

singh is absolutely right, but what u have to realise is that using asp.net webforms (to activate the disable attribute on insane option tags) with java consoles in a linux environment causes conflicts in internet explorer (& mozilla if u also have solitaire installed). & although the graphics will appear correct on apple macs, all the text will be translated into swahili!

the obvious solution is to install shindogu conflict analysis & unconflictalyser 2004... (not available in any shop, or online... or anywhere else!)

hope that helps! ;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...