Last Comment Bug 175289 - radio buttons move the checked on a reload
: radio buttons move the checked on a reload
Status: RESOLVED DUPLICATE of bug 285730
:
Product: Core
Classification: Components
Component: Layout: Form Controls (show other bugs)
: Trunk
: x86 All
: P3 minor with 5 votes (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
: 273631 274854 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-10-18 08:12 PDT by Dimitri Aivaliotis
Modified: 2007-01-18 20:48 PST (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Example with two hidden fields & five buttons (374 bytes, text/html)
2002-10-18 10:02 PDT, Kenneth Herron
no flags Details
a lot of working and non-working 3 element radio tests (3.04 KB, text/html)
2004-10-29 07:22 PDT, Márton Németh
no flags Details
checkmark moves upwards if reloaded (see comment #7) (927 bytes, text/html)
2004-10-29 09:26 PDT, Márton Németh
no flags Details
testcase w/10 radio buttons - pre-checked button disappears at location of hidden field (933 bytes, text/html)
2005-01-26 15:05 PST, David F
no flags Details

Description Dimitri Aivaliotis 2002-10-18 08:12:20 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021017 Phoenix/0.3
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021017 Phoenix/0.3

When a form is defined within a table, and that table has an input element outside 
of a row, as well as others inside a row, a radio button group within a row will
move the checked button on a page reload (either explicit or using back/forward)
until no button is checked.

Reproducible: Always

Steps to Reproduce:
1. Load the following html:
<html>
<body>
<table>
<form>
<input type="hidden" name="v" value="1">
<tr>
<td>
<input type="radio" name="t" value="1">
<input type="radio" name="t" value="2">
<input type="radio" name="t" value="3" checked>
</td>
</tr>
</form>
</table>
</body>
</html>
2. Press the reload button.
3. Repeat step 2 until the checked button disappears.

Actual Results:  
The checked button moved from the rightmost to the middle to the leftmost until
no button was left checked.

Expected Results:  
Left the rightmost button checked.

The bug will go away if the form tag begins before the table and ends after it,
as it really should.  This does break compatibility with Netscape 4.7x however.
Comment 1 Kenneth Herron 2002-10-18 10:00:11 PDT
Confirmed with solaris mozilla (not phoenix) 2002101622. Hitting reload causes
the checkmark to move one radio button to the left. Hitting shift-reload resets
the form to the correct state.

In the example, the hidden field has to come before the <tr></tr> block; if it's
anywhere else in the form, the behavior doesn't occur.

This might be related to bug 171972.
Comment 2 Kenneth Herron 2002-10-18 10:02:52 PDT
Created attachment 103337 [details]
Example with two hidden fields & five buttons

This is a variant of the reporter's example. It has two hidden fields and five
radio buttons. The highlighted button moves by two on every reload.
Comment 3 John Keiser (jkeiser) 2002-12-10 20:48:04 PST
That's some freaky shit.
Comment 4 Terri Preston 2002-12-10 21:14:28 PST
Agreed, confirmining freakiness on win XP trunk 2002120808 and Mac OS X trunk
build 2002120508, OS to all
Comment 5 Brett A. Taylor 2004-05-20 20:05:55 PDT
This bug still exists in 1.7b (20040320)!
Comment 6 Dain Anderson 2004-07-22 08:20:37 PDT
Confirmed with Windows Server 2003 w/FireFox 0.9.1:

Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.7) Gecko/20040626
Firefox/0.9.1(In reply to comment #0)
> User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b)
Gecko/20021017 Phoenix/0.3
> Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b)
Gecko/20021017 Phoenix/0.3
> 
> When a form is defined within a table, and that table has an input element
outside 
> of a row, as well as others inside a row, a radio button group within a row will
> move the checked button on a page reload (either explicit or using back/forward)
> until no button is checked.
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1. Load the following html:
> <html>
> <body>
> <table>
> <form>
> <input type="hidden" name="v" value="1">
> <tr>
> <td>
> <input type="radio" name="t" value="1">
> <input type="radio" name="t" value="2">
> <input type="radio" name="t" value="3" checked>
> </td>
> </tr>
> </form>
> </table>
> </body>
> </html>
> 2. Press the reload button.
> 3. Repeat step 2 until the checked button disappears.
> 
> Actual Results:  
> The checked button moved from the rightmost to the middle to the leftmost until
> no button was left checked.
> 
> Expected Results:  
> Left the rightmost button checked.
> 
> The bug will go away if the form tag begins before the table and ends after it,
> as it really should.  This does break compatibility with Netscape 4.7x however.

(In reply to comment #0)
> User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b)
Gecko/20021017 Phoenix/0.3
> Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b)
Gecko/20021017 Phoenix/0.3
> 
> When a form is defined within a table, and that table has an input element
outside 
> of a row, as well as others inside a row, a radio button group within a row will
> move the checked button on a page reload (either explicit or using back/forward)
> until no button is checked.
> 
> Reproducible: Always
> 
> Steps to Reproduce:
> 1. Load the following html:
> <html>
> <body>
> <table>
> <form>
> <input type="hidden" name="v" value="1">
> <tr>
> <td>
> <input type="radio" name="t" value="1">
> <input type="radio" name="t" value="2">
> <input type="radio" name="t" value="3" checked>
> </td>
> </tr>
> </form>
> </table>
> </body>
> </html>
> 2. Press the reload button.
> 3. Repeat step 2 until the checked button disappears.
> 
> Actual Results:  
> The checked button moved from the rightmost to the middle to the leftmost until
> no button was left checked.
> 
> Expected Results:  
> Left the rightmost button checked.
> 
> The bug will go away if the form tag begins before the table and ends after it,
> as it really should.  This does break compatibility with Netscape 4.7x however.
Comment 7 Jordan Marinov 2004-09-15 15:09:34 PDT
I have the same problem with this simple HTML. On every F5 reload the checked
goes one place higher. If I put the hidden field in the end it works.

-----

<html>
<body>
<table>
  <form action='test' method='Post'>
  <input type='Hidden' name='foo' value='bar'>
    <tr><td><input type='Radio' name='service' value='0'></td><td>0</td></tr>
    <tr><td><input type='Radio' name='service' value='1'></td><td>1</td></tr>
    <tr><td><input type='Radio' name='service' value='2'></td><td>2</td></tr>
    <tr><td><input type='Radio' name='service' value='3'
checked></td><td>3</td></tr>
    <tr><td><input type='Radio' name='service' value='4'></td><td>4</td></tr>
    <tr><td><input type='Radio' name='service' value='5'></td><td>5</td></tr>
    <tr><td><input type='Radio' name='service' value='6'></td><td>6</td></tr>
    <tr><td><input type='Radio' name='service' value='7'></td><td>7</td></tr>
    <tr><td><input type='Radio' name='service' value='8'></td><td>8</td></tr>
    <tr><td><input type='Radio' name='service' value='9'></td><td>9</td></tr>
</form>
</table>
</body>
</html>
Comment 8 Márton Németh 2004-10-29 07:22:22 PDT
Created attachment 163839 [details]
a lot of working and non-working 3 element radio tests

This test contains of a
 - hidden field
 - table
 - 3 element radio box

If the page reloaded (Ctrl+R) the default checking disappears, or moves up.
If the page reloaded full (Ctrl+Shift+R), the default settings are back again.

Tested with:
Mozilla/5.0 (X11; U; Linux i686; hu-HU; rv:1.7.2) Gecko/20040803
Comment 9 Márton Németh 2004-10-29 07:26:35 PDT
(bug 265470 may talking about the same bug.)
Comment 10 Márton Németh 2004-10-29 09:26:54 PDT
Created attachment 163854 [details]
checkmark moves upwards if reloaded (see comment #7)


Testcase from comment #7

The checkmark moves upwards if reloaded.

Also tested with: 
Mozilla/5.0 (X11; U; Linux i686; hu-HU; rv:1.7.2) Gecko/20040803
Comment 11 Erik Fabert 2004-12-08 02:04:35 PST
*** Bug 273631 has been marked as a duplicate of this bug. ***
Comment 12 Mohammad M. Purbo 2004-12-16 02:16:05 PST
*** Bug 274854 has been marked as a duplicate of this bug. ***
Comment 13 Ben Fowler 2004-12-18 03:41:38 PST
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8a6) Gecko/20041215
Firefox/1.0+

This is still in.

After Reload the render and the View Source disagree, Shift Reload fixes
this (as previously reported).

Note that there are roughly 35 markup errors in attachment (id=163854) 
Comment 10 .

What is the desired behaviour here? See the last lines of the original
report. When Forms/Widgets are sufficiently out of spec as to cause
Freaky **** (Comment 3 ), should we make the offending items invisible?

The code/bloat to fix up all possible erroneous html might be enormous.



Comment 14 David F 2005-01-26 15:05:46 PST
Created attachment 172501 [details]
testcase w/10 radio buttons - pre-checked button disappears at location of hidden field

Interestingly, if there's a hidden field somewhere between the first and last
radio buttons, and outside of a table cell, the checked item disappears when it
hits the location of the hidden field.

Also very strange is that if the CHECKED item is changed in the source HTML to
the last item (option 10), this bug disappears.
Comment 15 David F 2005-01-26 15:12:46 PST
Comment on attachment 172501 [details]
testcase w/10 radio buttons - pre-checked button disappears at location of hidden field

><HTML><HEAD/>
><BODY><INPUT type="hidden" value="1" name="hiddenfield"/>
><TABLE cellspacing="0" cellpadding="0" border="0">
><TBODY><TR valign="top" align="left">
><FORM method="post" action="radiobug.html"/>
><TD><INPUT type="radio" value="1" name="myradio"/> option 1</TD>
><TD>
><INPUT type="radio" value="2" name="myradio"/> option 2<BR/>
><INPUT type="radio" value="3" name="myradio"/> option 3<BR/>
><INPUT type="radio" value="4" name="myradio"/> option 4
></TD><TD>
><INPUT type="radio" value="5" name="myradio"/> option 5 <BR/>
><INPUT type="radio" value="6" name="myradio"/> option 6<BR/>
><INPUT type="radio" value="7" name="myradio"/> option 7
></TD>
><TD>
><INPUT type="radio" value="8" name="myradio"/> option 8<BR/>
><INPUT type="radio" checked="checked" value="9" name="myradio"/> option 9<BR/>
><INPUT type="radio" value="10" name="myradio"/> option 10
></TD>
></TR>
><TR align="right">
><TD valign="middle"><INPUT type="submit" value="  Update  " name="submit"/>	
></TD>
>
></TR>
></TBODY></TABLE></BODY></HTML>
Comment 16 Peter-Paul Koch 2005-11-01 09:09:33 PST
Also occurs when you remove a form field (removeChild). See http://www.quirksmode.org/js/tests/moz_radios.html for a test page.
Comment 17 Boris Zbarsky [:bz] (TPAC) 2007-01-18 20:48:17 PST

*** This bug has been marked as a duplicate of bug 285730 ***

Note You need to log in before you can comment on or make changes to this bug.