Open Bug 300016 Opened 19 years ago Updated 2 years ago

SELECTED Option on SELECT structures does not select on Linux.

Categories

(Core :: DOM: Core & HTML, defect)

1.8 Branch
x86
All
defect

Tracking

()

People

(Reporter: thom, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

The following text box displays on Linux with the Voyager2 item selected. On
Windows in both IE and Firefox, the Paragon option is selected. The Paragon
option should be selected when the page first displays.

        <SELECT NAME="SysName" WIDTH="100%">
          <OPTION VALUE=Paragon SELECTED>Paragon XL</OPTION>
          <OPTION VALUE=Thom>Thom Cool System</OPTION>
          <OPTION VALUE=Voyager2>Voyager 2</OPTION>
        </SELECT>

And here's the whole page if you can't re-create...

<HTML>
<HEAD>
  <TITLE>Rex Configuration--Page 1</TITLE>
  <META HTTP-EQUIV="content-type" CONTENT="text/html;charset=iso-8859-1"/>
  <META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW"/>
  <META NAME="description" CONTENT="none"/>
  <META NAME="keywords" CONTENT="none"/>
  <META NAME="Author" CONTENT="Heavyweight Software--www.HeavyweightSoftware.com"/>
  <META NAME="GENERATOR" CONTENT="CGI Script by Heavyweight Software"/>

  <LINK REL="stylesheet" HREF="/rex/heavyweight.css" TYPE="text/css">
</HEAD>
<BODY BACKGROUND="/rex/images/idx_tile.png">
  <CENTER><H1>Rex Configuration--Page 1</H1></CENTER>
    <FORM ACTION="/rex/cgi-bin/rex_config.cgi" MEHTOD="post" NAME="Configure1">
      <INPUT TYPE="hidden" NAME="Page" VALUE="1"/> <BR>
<P>Paragon</P>
      <CENTER>

        <H2>Choose MLS type</H2>
        <SELECT NAME="SysName" WIDTH="100%">
          <OPTION VALUE=Paragon SELECTED>Paragon XL</OPTION>
          <OPTION VALUE=Thom>Thom Cool System</OPTION>
          <OPTION VALUE=Voyager2>Voyager 2</OPTION>
        </SELECT>
      </CENTER>

      <BR>
      <BR>
      <BR>
      <TABLE WIDTH="100%">
        <TR>
          <TD WIDTH="75%" ALIGN="Right">
            <INPUT TYPE="image" BORDER=0 NAME="doit" SRC="/rex/images/next.png"/>
          </TD>
          <TD>

            &nbsp;
          </TD>
        </TR>
      </TABLE>

    </FORM>

    <BR> <BR>

    <CENTER><P class="app_name">

      RE Transform Converter--Configuration Utility
    </P></CENTER>
  <CENTER><BR><BR>
	<EM>&copy Copyright 2005 <A
HREF="http://www.HeavyweightSoftware.com/Rex">Heavyweight Software</A>. All
rights reserved.</EM>
  </CENTER>
</BODY></HTML>

Reproducible: Always

Steps to Reproduce:
1. Load the page.
2.
3.

Actual Results:  
The Voyager2 option is selected instead of the Paragon option.

Expected Results:  
selected the Paragon option by default.
This bug also affects windows.
I tried your full page in both :
Mozilla/5.0 (Windows; U; Win98; fr-FR; rv:1.7.12) Gecko/20050915
and
Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8b5) Gecko/20051006 Firefox/1.4.1

It works fine in the two browsers.
The Paragon XL option is selected by default.

Please try if you can with a more recent build of Firefox like 1.0.7 or the 1.5
Beta 2 version and post the results you get.
I get the same behavior. This actually cost my client money because they  had to refund shipping costs to a user. Bad bug.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

<form>
  <table id="productLine">
    <tbody>
      <tr id="ROW-TECRA UNQ PLUS">
        <td><select id="SHIPPING-TECRA UNQ PLUS" >
            <option value="TECRA UNQ PLUS"  selected="selected"> Ground</option>
            <option value="TECRA UNQ PLUS"  > 2nd Day</option>
            <option value="TECRA UNQ PLUS"  > Next Day</option>
          </select>
        </td>
      </tr>
      <tr id="ROW-PF-321">
        <td><select id="SHIPPING-PF-321" >
            <option value="PF-321"  > Ground</option>
            <option value="PF-321"  selected="selected"> 2nd Day</option>
            <option value="PF-321"  > Next Day</option>
          </select>
        </td>
      </tr>
      <tr id="ROW-PF-33-4KD">
        <td><select id="SHIPPING-PF-33-4KD" >
            <option value="PF-33-4KD"  > Ground</option>
            <option value="PF-33-4KD"  selected="selected"> 2nd Day</option>
            <option value="PF-33-4KD"  > Next Day</option>
          </select>
        </td>
      </tr>
      <tr id="ROW-PF-412">
        <td><select id="SHIPPING-PF-412" >
            <option value="PF-412"  > Ground</option>
            <option value="PF-412"  selected="selected"> 2nd Day</option>
            <option value="PF-412"  > Next Day</option>
          </select>
        </td>
      </tr>
    </tbody>
  </table>
</form>
(In reply to comment #3)

Actually it does initially load correctly, but if you click the reload button on FF it defaults the the last option in the list, and ingnores the selected attribute. Sorry for the confusion.

this happened to me on Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5.

confirming, updating OS, trying to move to core/html: form submission
Status: UNCONFIRMED → NEW
Component: General → HTML: Form Submission
Ever confirmed: true
OS: Linux → All
Product: Firefox → Core
Version: unspecified → 1.8 Branch
> The following text box displays on Linux with the Voyager2 item selected. On
> Windows in both IE and Firefox, the Paragon option is selected. The Paragon
> option should be selected when the page first displays.

I can confirm this bug on OpenSuSE 10 with Firefox 1.0.7 (using Konqueror as a control). I coded a form POSTS the inputed data to a PHP script. If any field is missing, the script returns the user to the form and pre-enters all the data that the user entered (so user doesn't have to fill in all fields again). On a select field on my form, the user has chosen a country. Thus the country chosen should be automatically selected. In the page source it IS selected and in Konqueror the country is also displayed as being selected. Firefox, however, shows the first country in the list, whether or not it was selected.
This bug also affects me on a fully updated Windows XP Professional with Firefox 1.5.0.1

It seems to somehow be related to chaching. If I do a full refresh with Ctrl-Shift-R, then the correct options will be selected.
I can confirm the same bug with Seamonkey under OS X and agree with comment #7 that it appears to be a caching issue.

I encountered it with a CGI generated page where I had temporarily changed the code so that no match could be selected, thereby activating a CGI module default which inserts and selects a dummy first item. I then added back new code to select a valid match which thus removed the dummy entry from the top of the select list, then tested the new CGI code by a browser Reload. While View Source showed the correct items marked as selected, the Seamonkey browser incorrectly showed the new first items as being selected.

I think the summary could be beneficially changed to something like "SELECTED Option on SELECT structures caching incorrectly" to reflect the wider OS scope (than the original Linux) and more precise diagnosis (it does select, just not as required).
Assignee: nobody → form-submission
QA Contact: general → ian
Attached file Minimal testcase
This file contains a minimal testcase for the bug. To see the bug:

1. Save the file to your disk.
2. Open the file in Firefox. Notice that the select shows "0".
3. Edit the file on your disk and change "Choose one:" to "XXX" and move "selected" to entry "1". Save the file.
4. Press the Reload button in Firefox.

Firefox will now show "XXX 0". Pressing Shift-Reload will show "XXX 1".

Expected behaviour: Firefox should show "XXX 1" after pressing Reload and the same after pressing Shift-Reload.

Tested with Firefox 1.5 on Windows XP.
Hi,

I noticed the same bug on Firefox 1.5, Redhat Linux 9 or Windows 2000, when *using DOM API* to create the select widget (but worked with xhtml code) :

-----8x---

<form id="modification3">
<input type="hidden" name="cmd" value="ubc"/>
<input type="submit" name="submit1" value="Save"/>
</form>
                                                                                                                       
<script type="text/javascript">
                                                                                                                       
  td_select = document.createElement('select');
                                                                                                                       
  td_option = document.createElement('option');
  td_select.appendChild(td_option);
  td_option.setAttribute('value','any');
  td_option.appendChild(document.createTextNode('any'));
                                                                                                                       
  td_option = document.createElement('option');
  td_select.appendChild(td_option);
  td_option.setAttribute('value','all');
  td_option.setAttribute('selected','selected');
  td_option.appendChild(document.createTextNode('all'));
                                                                                                                       
  td_option = document.createElement('option');
  td_select.appendChild(td_option);
  td_option.setAttribute('value','none');
  td_option.appendChild(document.createTextNode('none'));
                                                                                                                       
  td_form = document.getElementById("modification3");
  td_form.appendChild(td_select);
</script>

---------8X----------
Marc-Olivier BERNARD
(In reply to comment #10)
> Hi,
> 
> I noticed the same bug on Firefox 1.5, Redhat Linux 9 or Windows 2000, when
> *using DOM API* to create the select widget (but worked with xhtml code) :

In this code, it seems that setAttribute will work if it comes before td_option has been appended to td_select.
This version works:

td_option = document.createElement('option');
td_option.setAttribute('value','all');
td_option.setAttribute('selected','selected');
td_option.appendChild(document.createTextNode('all'));
td_select.appendChild(td_option); // <- this line moved down.

[...]

>   td_option = document.createElement('option');
>   td_select.appendChild(td_option);
>   td_option.setAttribute('value','all');
>   td_option.setAttribute('selected','selected');
>   td_option.appendChild(document.createTextNode('all'));
(In reply to comment #11)

> In this code, it seems that setAttribute will work if it comes before td_option has been appended to td_select.
> This version works:
> 
> td_option = document.createElement('option');
> td_option.setAttribute('value','all');
> td_option.setAttribute('selected','selected');
> td_option.appendChild(document.createTextNode('all'));
> td_select.appendChild(td_option); // <- this line moved down.
> 
> [...]

Hum, Afaik about DOM standard, that should make any difference?
I have just run into this bug on Windows 1.5.0.7, 2.0b and Mac OS X 10.4 Firefox 1.5.0.7.  (so lets have a leap of faith and assume its all :)

It seems slightly odd, safari and IE both respect the selected="selected" option.  Firefox 'usually' does but on certain select boxes it falls back on the last option the user used. As mentioned by somebody else the correct element is select upon a forced refresh.
Just a quick fix.

Setting autocomplete=off will stop firefox jumping to a previous value and adhire to the selected="selected" atribute.
eg.

<select id="foo" autocomplete="off">
<option value="foo">FOO</option>
<option value="bar" selected="selected">BAR</option>
</select>

ref: http://www.w3.org/Submission/web-forms2/#the-autocomplete
Confirmed this bug for:

Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.8.1) Gecko/20061023 SUSE/2.0-30 Firefox/2.0

The workaround with autocomplete="off" in the last comment works
This is still a bug for Firefox 3 on linux
This bug is still present. User-Agent:Mozilla/5.0 (X11; U; Linux i686; en-US; rv%3a1.9.0.6) Gecko/2009020414 CentOS/3.0.6-1.el5.centos Firefox/3.0.6

Autocomplete workaround fixes it but strikes me as an "explorer type solution"?
Assignee: form-submission → nobody
QA Contact: ian → form-submission
Still present in:

Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6

Autocomplete is still a valid workaround.

Any chance https://bugzilla.mozilla.org/show_bug.cgi?id=487958 is related? We removed all cache control options in favor of the autocomplete attribute though.
Component: HTML: Form Submission → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: