Closed Bug 366006 Opened 18 years ago Closed 16 years ago

FireFox <select> Issue - Selected in option does not work.

Categories

(Core :: Layout: Form Controls, defect)

defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: d_moree, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

If you visit an HTML form that has a <select> in it, any options flagged with "selected" are not selected. This is only apparent in version 2.x. This is not an issue in previous versions.

Reproducible: Always

Steps to Reproduce:
1. Visit and HTML form with a <select> with an option that is flagged "selected".
2.
3.
Actual Results:  
I got the error!

Expected Results:  
Selected the flagged option? Just guessing here! lol :)
Today I also stumbled upon this bug, but found out that it *does* work when the select has the name attribute set. So for select's without name, the 'selected' flag does not work, but for selects that have a name it does.
Interesting behavior of this bug in Firefox 2.0.0.1 (Windows 2000 Pro)
This might help someone find the problem:  I've got a <select> without
a name attribute (I tend to use id="xxx" for identification).  The
"selected" mechanism WORKS if there is nothing ahead of the <select> in
a form, FAILS if an <input> tag appears ahead of it, and WORKS AGAIN
if there are two (or more) <input> tags ahead of it. 

<form><select id="xxx"><option selected ....          WORKS

<form><input...><select ...                           FAILS

<form><input...><input...><select...>                 WORKS

Of course, it always works if the select has a "name" attribute, as noted above.
The following works, but try it after removing the input tag "feelingbetter"

------------EXAMPLE HTML

<form>
<input type="hidden" value="feebleminded"/>
<input type="hidden" value="feelingbetter"/>

<select id="pselect">
 <option value=1>          Primo   </option>
 <option selected value=2> Secundo </option>
 <option value=3>          Trey    </option>
</select>
</form>
This is not the case in 2.0.0.6 version (windows xp sp 2). It doesn't matter if a tag SELECT has the NAME attribute or not. The first time a form loads it is OK: selected option is the one which was set SELECTED flag. But just change SELECTED flag to another OPTION tag and reload the form: the selected option leaves unchanged.
Firefox 3.0 RC1 has the same problem.
Confirming the behaviour of comment #3 using the following builds:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.17) Gecko/2008092213 Ubuntu/7.10 (gutsy) Firefox/2.0.0.17
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b3pre) Gecko/20081214 SeaMonkey/2.0a3pre

We are currently doing this (moving the selected-flag) in a embedded configuration page. Gecko-based browsers only update the selection on a forced (shift-strg-R) reload, not on the JS-triggered refresh. Which is annoying as the user should be able to see changing values. 

Additional Info: using following DOctype:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

(and XHTML-conforming 'selected="selected"', plain 'selected' doesn't work either
Status: UNCONFIRMED → NEW
Component: General → Layout: Form Controls
Ever confirmed: true
OS: Windows XP → All
Product: Firefox → Core
QA Contact: general → layout.form-controls
Hardware: PC → All
Version: unspecified → Trunk
Summary: FireFox 2.x <select> Issue - Selected in option does not work. → FireFox <select> Issue - Selected in option does not work.
Comment 3 and comment 5 are bug 210095 or bug 46845 (via bug 253172, bug 320848, bug 305482, etc), as far as I can tell.

They seem to have nothing to do with this bug as originally reported, since Daniel doesn't say anything about reloading.

The bug as originally reported worksforme.  Given lack of a testcase or url, marking incomplete.  Please reopen if you can point me to an HTML page that shows the original reported problem.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.