<option value="something" selected> does not actually select option

VERIFIED DUPLICATE of bug 46845

Status

()

Firefox
General
VERIFIED DUPLICATE of bug 46845
13 years ago
12 years ago

People

(Reporter: Robert Soden, Assigned: Blake Ross)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0

This bug was posted earlier for the winXP version of Firefox1.0, but I have
found that the windows version WORKS and the OS X version DOES NOT.

When building a <select> form element with PHP's print() function, Firefox seems
to ignore the "selected" property within the subsequent <option> tags. It simply
defaults to the first <option> in the list.

I was not able to reproduce this error in the Win XP version of Firefox. IE also
displays the page correctly. It seems to be specific to the OS X version.

Reproducible: Always

Steps to Reproduce:
Execute the following PHP script:

<select name="mySelect">
<?php
  print("<option value=\"somevalue\">value 1</option>");
  print("<option value=\"othervalue\" selected>value 2</option>");
?>
</select>
Actual Results:  
"value 1" will be selected on page load instead of "value 2"


Expected Results:  
"value 2" should be selected as per the "selected" property in the  second
<option> tag.

Comment 1

13 years ago
Could I suggest that you establish a scrupulously exact recipe (and include
a complete testcase) to be sure that you are not seeing a Dup of Bug 46845 
"Form elements don't reset upon manually reloading page"?

Comment 2

13 years ago
Also check <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=257715">257715</a>

Comment 3

12 years ago
On mac os x 10.4.1, firefox 1.0.2, reproduce this bug by hitting reload with
this example web page:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Test Selected on Reload</title>
</head>

<body>
    <select>
        <option>first</option>
        <option selected>second</option>
        <option>third</option>
    </select>
</body>
</html>

Comment 4

12 years ago
Created attachment 184074 [details]
Reporter's Testcase

1. Open Page => shows 'second'
2. Select 'first'
3. Reload shows 'second', subsequent reloads alternate between 'first' and
'second'

A shift reload takes up back to 'second' (as expected).

This behaviour is an exact match of Bug 294258 "Reload clears form values, 
incorrectly", and this report is therefore a Dup of either that bug or 
(more resaonably) Bug 46845 "Form elements don't reset upon manually 
reloading page"
(Reporter)

Comment 5

12 years ago

*** This bug has been marked as a duplicate of 46845 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.