Closed Bug 274795 Opened 20 years ago Closed 20 years ago

option selected="selected" is not working

Categories

(Core :: DOM: HTML Parser, defect)

1.7 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 46845

People

(Reporter: hinrichs, Unassigned)

Details

This html does not cause an option to be selected:
<option label="14" value="14" selected="selected">14</option>
Can you provide more details, specifics like
- browser version and browser build number
- *_reduced_* testcase where this happens

Without the usual info needed to confirm a bugfile, there is very little
volunteer QA people can do here.

Bug writing guidelines
http://www.mozilla.org/quality/bug-writing-guidelines.html

What is a Simplified Test Case, and How Do I Make One?
http://www.mozilla.org/newlayout/bugathon.html#testcase
Sorry, I thought there would be enough info from the form.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20040910

I am not sure what you mean by reduced test case.  The test case is to create an
html page with a form on it and a select list.  Create several options, and in
one of them enter the attribute selected="selected".

example:
<form method="post">
<select name="startDate[Date_Month]">
<option label="January" value="01">January</option>
<option label="February" value="02">February</option>
<option label="March" value="03">March</option>
<option label="April" value="04">April</option>
<option label="May" value="05">May</option>
<option label="June" value="06">June</option>

<option label="July" value="07">July</option>
<option label="August" value="08">August</option>
<option label="September" value="09">September</option>
<option label="October" value="10">October</option>
<option label="November" value="11">November</option>
<option label="December" value="12" selected="selected">December</option>
</select>
</form>
I pasted your code into a new document, and it works for me.

Do you have a URL which doesn't work, or a complete document
that you post?
Try this--it is not working for me:<form method="post">
<select name="startDate[Date_Month]">
<option label="January" value="01">January</option>
<option label="February" value="02">February</option>
<option label="March" value="03">March</option>
<option label="April" value="04">April</option>
<option label="May" value="05">May</option>
<option label="June" value="06">June</option>

<option label="July" value="07">July</option>
<option label="August" value="08">August</option>
<option label="September" value="09">September</option>
<option label="October" value="10">October</option>
<option label="November" value="11" selected="selected">November</option>
<option label="December" value="12">December</option>
</select>
</form>

Please forgive me, in my prior post I inadvertently pasted a bad example, as the
select was on the last item.  
Thank you.
I pasted your code from comment 4 into a new document, and it works for me.

Do you have a URL which shows the non-working behaviour, or a complete 
document that you can post?

It is possible that the problem is in part of your document that we have not 
seen yet.
(In reply to comment #5)
Ok, strangely that example is working for me now.  I am sorry that I have not
been able to provide a good example.  I'm puzzled because I am sure I confirmed
the example was not working.  I am sorry but I don't have this on a public page.

So, here is the complete form.  Here there are three selects each with a
selected option.  Pasting this code into a file and viewing it, the default
selects are not working.  I cannot find a flaw in the html or in my test procedure.

<form method="post">
<p>
Since: <select name="sinceDate[Date_Month]">
<option label="January" value="01">January</option>
<option label="February" value="02">February</option>
<option label="March" value="03">March</option>
<option label="April" value="04">April</option>
<option label="May" value="05">May</option>
<option label="June" value="06">June</option>
<option label="July" value="07">July</option>

<option label="August" value="08">August</option>
<option label="September" value="09">September</option>
<option label="October" value="10">October</option>
<option label="November" value="11" selected="selected">November</option>
<option label="December" value="12">December</option>
</select>
<select name="sinceDate[Date_Day]">
<option label="01" value="1">01</option>
<option label="02" value="2">02</option>
<option label="03" value="3">03</option>

<option label="04" value="4">04</option>
<option label="05" value="5">05</option>
<option label="06" value="6">06</option>
<option label="07" value="7">07</option>
<option label="08" value="8">08</option>
<option label="09" value="9">09</option>
<option label="10" value="10">10</option>
<option label="11" value="11">11</option>
<option label="12" value="12">12</option>

<option label="13" value="13">13</option>
<option label="14" value="14">14</option>
<option label="15" value="15">15</option>
<option label="16" value="16" selected="selected">16</option>
<option label="17" value="17">17</option>
<option label="18" value="18">18</option>
<option label="19" value="19">19</option>
<option label="20" value="20">20</option>
<option label="21" value="21">21</option>

<option label="22" value="22">22</option>
<option label="23" value="23">23</option>
<option label="24" value="24">24</option>
<option label="25" value="25">25</option>
<option label="26" value="26">26</option>
<option label="27" value="27">27</option>
<option label="28" value="28">28</option>
<option label="29" value="29">29</option>
<option label="30" value="30">30</option>

<option label="31" value="31">31</option>
</select>
<select name="sinceDate[Date_Year]">
<option label="1999" value="1999">1999</option>
<option label="2000" value="2000">2000</option>
<option label="2001" value="2001">2001</option>
<option label="2002" value="2002" selected="selected">2002</option>
<option label="2003" value="2003">2003</option>
<option label="2004" value="2004">2004</option>
</select>

</p>
<p>
View:
<ul>
<li><input type="checkbox" checked name="newContactRecords" /> new contact
records</li>
<li><input type="checkbox" checked name="updatedContactRecords" /> updated
contact records</li>
</ul>
</p>
<p>
<input type="submit" name="dataReportSubmit" value="submit">
</p>
</form>

I pasted your code from comment 6 into a new document, and it works for me.

Do you have a URL which shows the non-working behaviour?

> Do you have a URL which shows the non-working behaviour?


I put it up at http://www.bobisfamous.com/formtest.html.  This has revealed a
new insight as to why this is so difficult to track down.

If you visit the page for the first time, the form defaults will respond as they
should.

But if you paste the form into a new document, view it, then edit it so that
different default selections should be shown, then hit the browser's reload
button (no + shift), the old defaults will remain.  Holding down +shift will
cause it to refresh with new defaults.  This is the feature/bug that I was seeing.

The question is whether or not this behavior is a bug.  Internet Explorer
refreshes the page (no +shift) with the new defaults when the page is edited. 
Of course just because I.E. does it does not mean Mozilla should.  However I
originally came across this behavior on a dynamically-generated page (in my
application, the form should default to yesterday's date).  I found that
changing the timestamp that controls the appearance of yesterday's date in the
form was not changing the form when I reloaded the page during development. 
That seems like a bug.

(In reply to comment #8)
>  ... .  I found that
> changing the timestamp that controls the appearance of yesterday's date in the
> form was not changing the form when I reloaded the page during development. 
> That seems like a bug.

Reload and Shift-Reload are two different things. You may need to check
the headers and the actual network traffic.

As a simulacrum, you could check the source that the browser is rendering 
and the page info.

If (to take a simple example) your server sets the page's expiration date
to one hour from the time it was generated, then a simple reload may well
only check the time, and not pull down a new copy.

You may want to check your CMS's docs for how to ensure that round trips
to the server occur, if that is what you want.
(In reply to comment #9)

The same result occurs if it is a local file on my windoze xp, which I am sure
is modifying the date of the file and does not depend on server headers.

Also could one assume that since I.E. updates the default selections upon a
normal reload, and Mozilla is not, that this behavior is due to browser-specific
behavior and not due to the server or the network?

The re-creation test is this: put the code in a local file.  Load the file into
the browser.  Change the default selections in the html.  Hit "reload" to see if
the default selections change.
Thank you for the recipe or 'recreation test', I have got it now.

Dup of Bug 263363 ; There are many other bugs on Form reload and cacheing.

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