Bug 148118

Summary: Form-reset triggers superfluous onchange event in radiobutton and checkbox
Product: [Applications] konqueror Reporter: Johannes Zarl-Zierl <johannes>
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Johannes Zarl-Zierl 2007-07-22 20:22:48 UTC
Version:           3.5.7 (using KDE 3.5.7, Debian Package 4:3.5.7.dfsg.1-1 (lenny/sid))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.18.8

When a form contains radio-buttons or checkboxes with changes, resetting the form triggers an onchange-event.

I couldn't find anything in the html-standard (http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.3) explicitly forbidding this behaviour, but for other form-fields (text-fields, textarea, select), or using other browsers(Opera 9.12, Iceape 1.1.2) this doesn't happen. So I guess it's a bug.

The following document should trigger the behaviour (just change some value and hit reset):

<html>
    <head>
        <title>Form-test</title>
    </head>
    <body>
        <form name='myform'>
            <input type='checkbox' name='checkbox' onChange='alert("checkbox 1")' checked/>
            <input type='checkbox' name='checkbox' onChange='alert("checkbox 2")'/>
            <input type='radio' name='radiobtn' onChange='alert("radiobutton 1")' checked/>
            <input type='radio' name='radiobtn' onChange='alert("radiobutton 2")'/>
            <input type='reset' name='resetbutton' value='Reset'  />
        </form>
    </body>
</html>
Comment 1 Maksim Orlovich 2008-10-18 18:37:37 UTC
SVN commit 873059 by orlovich:

Rework how we do onchange for input/checkboxes, unbreaking it and simplifying things.
As we only want to fire it in response to user events, this just does it in defaultEventHandler.
Fixes kde-look wallaper settings, and along with Germain's previous fix this covers 
#165607, #170451. This also doesn't suffer from #148118

BUG:148118
BUG:165607
BUG:170451


 M  +8 -0      html/html_formimpl.cpp  
 M  +1 -12     rendering/render_form.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=873059
Comment 2 Maksim Orlovich 2008-10-18 18:39:23 UTC
SVN commit 873060 by orlovich:

Merged revision 873059:
Rework how we do onchange for input/checkboxes, unbreaking it and simplifying things.
As we only want to fire it in response to user events, this just does it in defaultEventHandler.
Fixes kde-look wallaper settings, and along with Germain's previous fix this covers 
#165607, #170451. This also doesn't suffer from #148118

BUG:148118
BUG:165607
BUG:170451

 M  +8 -0      html/html_formimpl.cpp  
 M  +1 -12     rendering/render_form.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=873060