Closed Bug 175289 Opened 22 years ago Closed 18 years ago

radio buttons move the checked on a reload

Categories

(Core :: Layout: Form Controls, defect, P3)

x86
All
defect

Tracking

()

RESOLVED DUPLICATE of bug 285730

People

(Reporter: dimitri, Unassigned)

References

Details

Attachments

(4 files)

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.
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.
Status: UNCONFIRMED → NEW
Ever confirmed: true
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.
That's some freaky shit.
Status: NEW → ASSIGNED
Priority: -- → P3
Target Milestone: --- → mozilla1.4beta
Agreed, confirmining freakiness on win XP trunk 2002120808 and Mac OS X trunk
build 2002120508, OS to all
OS: Linux → All
This bug still exists in 1.7b (20040320)!
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.
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>
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
(bug 265470 may talking about the same bug.)
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
Assignee: john → nobody
Status: ASSIGNED → NEW
QA Contact: tpreston → core.layout.form-controls
*** Bug 273631 has been marked as a duplicate of this bug. ***
Target Milestone: mozilla1.4beta → ---
*** Bug 274854 has been marked as a duplicate of this bug. ***
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.



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 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>
Also occurs when you remove a form field (removeChild). See http://www.quirksmode.org/js/tests/moz_radios.html for a test page.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: