Version: Unbekannt (using KDE 3.1.4) Installed from: SuSE Compiler: gcc version 3.3.1 (SuSE Linux) OS: Linux (i686) release 2.4.21-99-default The following code shows, that in some cases a group of dynamicly created radio-buttons is handled like checkboxes: More then one is shown as selected/checked and more then one value is sent. From the 4 shown ways to append them to a parent node only two are working in Konqueror 3.1.4 / 3.2beta but all do it in the current versions of Mozilla and Firebird. Greetings, Hinrich URI: http://www.sagernet.de/konqui_test.html code: <html><head><title>Konqueror and dynamic Radiobuttons</title> <script type="text/javascript"> function showRadioAttributes() { var input_element = document.getElementsByTagName("input"); for(i=0; i<input_element.length; ++i){ if(input_element[i].checked == true){ alert("selected is: " + input_element[i].getAttribute("name") + "[" + i + "] " + "value: " + input_element[i].getAttribute("value")); } } } var radio_name = "RadioGroup"; var value_array = new Array("A", "B", "C"); var parent_id = "RadioSpace"; function createRadio(grouping_mode) { var parent_node = document.getElementById(parent_id); var _fieldset = document.createElement("fieldset"); var radio_element, _type, _name, _id, _label, _for, _text; for(var i=0; i<value_array.length; ++i){ // create attributes _type = document.createAttribute("type"); _type.nodeValue = "radio"; _name = document.createAttribute("name"); _name.nodeValue = radio_name; _value = document.createAttribute("value"); _value.nodeValue = value_array[i]; _id = document.createAttribute("id"); _id.nodeValue = radio_name+value_array[i]; // create radio-element and set its attributes radio_element = document.createElement("input"); radio_element.setAttributeNode(_type); radio_element.setAttributeNode(_name); radio_element.setAttributeNode(_value); radio_element.setAttributeNode(_id); radio_element.addEventListener("click", showRadioAttributes, false); // create Label _text = document.createTextNode(value_array[i]); _label = document.createElement("label"); _label.appendChild(_text); _for = document.createAttribute("for"); _for.nodeValue = _id; _label.setAttributeNode(_for); _br = document.createElement("br"); // different ways to append radio-element an its description to fieldset switch(grouping_mode){ case "same_parent_with_text": _fieldset.appendChild(radio_element); _fieldset.appendChild(_text); _fieldset.appendChild(_br); break; case "same_parent_with_label": _fieldset.appendChild(radio_element); _fieldset.appendChild(_label); _fieldset.appendChild(_br); break; case "same_parent_with_label_and_text": _fieldset.appendChild(radio_element); _fieldset.appendChild(_label); _fieldset.appendChild(_text); _fieldset.appendChild(_br); break; case "different_parents": new_block = document.createElement("div"); new_block.appendChild(radio_element); new_block.appendChild(_text); _fieldset.appendChild(new_block); break; }//endswitch }//endfor if (parent_node.hasChildNodes()) { parent_node.replaceChild(_fieldset, parent_node.firstChild); } else{ parent_node.appendChild(_fieldset); } //var grouping_mode_text = document.createTextNode(grouping_mode); document.getElementById("GroupingModeSpace").firstChild.replaceData(8,100,grouping_mode); }//endfunction </script></head> <body> <h3>Konqueror has a problem with dynamicly created Radio-Buttons</h3> <p>Here you can test 4 different ways to add a text-label to radio-buttons created with JavaScript/DOM. Two of them show a bug in Konqueror 3.1.4: It marks all clicked buttons as selected/checked. Not only the one who was clicked last.</p> <div style="background-color:#cccccc; width:600;"> <p>Works: <a href="javascript:createRadio('same_parent_with_text')"> All to the <b>same parent-node</b> together with <b>text-nodes</b></a></p> <p>Failes: <a href="javascript:createRadio('same_parent_with_label')"> All to the <b>same parent-node</b> together with <b>label-nodes</b></a></p> <p>Works(!): <a href="javascript:createRadio('same_parent_with_label_and_text')"> All to the <b>same parent-node</b> together with <b>label-nodes <u>and</u> text-nodes</b></a></p> <p>Failes: <a href="javascript:createRadio('different_parents')"> Each in a <b>different parent</b> together with <b>text-nodes</b></a></p> <form name="Testform" action="" method="POST"> <div id="GroupingModeSpace" style="color:#ff0000;">Method: </div> <div id="RadioSpace"></div> </form></div></body></html>
please attach the test case here
for test case see http://www.sagernet.de/konqui_test.html
Created attachment 4169 [details] test case
Created attachment 4939 [details] Static Test Case (no errors) Here is a highly simplified test case for this bug that you should be more comprehendable than the original. In this test case the HTML Form is loaded normally, and presents no problems to Konqueror.
Created attachment 4940 [details] Dynamic Test Case (errors!) This test case injects the exact same HTML Form into Konqueror, but does so using JavaScript. The result is that multiple radio selection becomes possible on the second and fourth sub-tests.
I believe the priority of this bug should be downgraded since it is so obscure, and since there are at least two workarounds.
Created attachment 6972 [details] simple testcase Simpler testcase. If you dynamically create a form with javascript that contains radiobuttons in a <fieldset>, and put any tag with an opening and closing tag, like <span>blah</span> inside the <fieldset> and before the last radiobutton, it kind of messes up the radiobutton group, so that you can select all buttons at the same time.
SVN commit 427263 by staikos: Merge webcore fix for replaceChild() BUG: 100457 BUG: 72430 M +4 -0 ChangeLog M +87 -8 ecma/kjs_binding.cpp M +25 -5 ecma/kjs_binding.h M +34 -25 xml/dom_nodeimpl.cpp M +2 -0 xml/dom_nodeimpl.h
Fix was reverted
#100457 has a more clear description of the bug. *** This bug has been marked as a duplicate of 100457 ***