Forum Moderators: open

Message Too Old, No Replies

Dropdown list question

I am stuck with this can anyone help

         

antenc

2:20 pm on Apr 1, 2005 (gmt 0)

10+ Year Member



Hello there,

Can anyone help me with the following problem.

I have two dropdown lists, and depending on the option selected in the first one i need to either remove or disable some of the options in the second so that they cannot be selected. I can check the values of the first dropdown list, but I am not sure how to go about doing the second bit. Any help would be much appreciated.

Thanks

antenc

birdbrain

5:24 pm on Apr 1, 2005 (gmt 0)



Hi there antenc,

and a warm welcome to these forums. ;)

This is what my reference book has to say about option attribute - disabled...


'The presence of this attribute disables the options element in the list.
Note that although the attribute disables the list choice in IE 5/Mac, as of
Version 6, IE/Windows provides no other functionality for this attribute.'

... in other words there will be, unfortunately, no cross browser compatibilty. :(

birdbrain

Bernard Marx

8:42 pm on Apr 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



"IE/Windows provides no other functionality for this attribute"

Whither the "other"?

Bernard Marx

11:05 pm on Apr 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Still not sure what this "other" is. BB is right that IE6 doesn't seem to care much for disabling of select options.

i need to either remove or disable some of the options

..that leaves the first option - of removal.
Try using the DOM method, removeChild, from the select element.

If you need more guidance, perhaps you could post the markup for the two drop-downs, and an indication correlation of selections to removed options, so we have something to work with. (cut down demo, if need be)

john_k

11:19 pm on Apr 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can set the classname or style for an individual option so that the text appears gray. Then work the onclick event to disallow the selection.