Bug Tracker

Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#5399 closed bug (worksforme)

Form option element not hiding in IE

Reported by: antonycarthy Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: select option hide Cc:
Blocked by: Blocking:

Description

The option elements in forms do not hide as expected. I assume this is known, but I cant find much on the web about it. The following code does not hide the option elements in the form select as expected in IE (up to 8) and perhaps in other browsers:

$('option').hide();

Is this a problem with option {display: hidden;} in IE?

This may be related to ticket #5396.

Change History (4)

comment:1 Changed 10 years ago by JeffMatthews

Yes, it is the same issue.

Note, also, that in FireFox, it is not quite right, either (but much better).

The <select> allows you to type the first letter in order to achieve a rapid scroll to the first option that matches that letter.

If you press a letter, FFox will jump to and display the hidden option, although, it will not let you select it.

comment:2 Changed 10 years ago by dmethvin

If the browsers handle this edge case differently, why not use a method that works in all of them? For example, just remove the options that are "hidden" from the list of options if they are not currently valid, or disable them. Will that suit this use-case? Can you point to some examples?

comment:3 Changed 10 years ago by JeffMatthews

I suppose it could be done that way, provided it worked. But still, it would require burdensome coding to make it happen.

For example, look at http://sovereignstates.net/StateLegislators/VSLegTracker.php

The behavior is shown in the drop down for the "Pick a state" options. If you pick "House" in the "Chamber" options, California should hide because it does not have a House. It has an Assembly.

You can see it hides in FFox, but not IE or Chrome. But check the keypress feature by pressing "C" in FFox, and California will display. So, really, none of them work as they should.

Now, to do the work-around suggested by actually removing these elements would mean storing removed elements in an array and accessing the array to get them back by appending into options. Sort of a "Recycle Bin," if you will. This would be required because you have to remember the name, value, id, class, style, etc. of the element. So, to store all that and hope you don't miss anything could be a pain, and probably asking for unwanted bugs.

Actually, what would probably be best is to have some Jquery code that performs like option and just scrap HTML's option altogether.

comment:4 Changed 9 years ago by dmethvin

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.