Description
In the reference behavior, the attachFormChoiceHandlers javascript function being rendered in onRenderHead incorrectly assumes that the individual choices we're attaching events to (the Radio or CheckBox components) are direct children of the group.
64) asb.append("function attachChoiceHandlers(markupid, callbackscript) {\n");
65) asb.append(" var choiceElement = document.getElementById(markupid);\n");
66) asb.append(" for( var x = 0; x < choiceElement.childNodes.length; x++ ) {\n");
67) asb.append(" if (choiceElement.childNodes[x] && choiceElement.childNodes[x].tagName) {\n");
68) asb.append(" var tag = choiceElement.childNodes[x].tagName.toLowerCase();\n");
69) asb.append(" if (tag == 'input')
\n");
72) asb.append(" }\n");
73) asb.append(" }\n");
74) asb.append("}\n");
The problem is the loop on line 66 - it only loops through direct child nodes, when in reality there could be other elements (like spans) in between the RadioGroup and the Radio in the dom, especially if for some reason the Radio was included as a part of another Component, which was actually added to the RadioGroup.
The fix should be simple, but I don't know the appropriate Wicket-approved function of recursing through children in the client-side.
As a side note, is there a reason this recursion is done on the client-side rather than on the server-side?
Attachments
Issue Links
- is duplicated by
-
WICKET-1271 Script in RenderHead method of AjaxFormChoiceComponentUpdatingBehavior needs fixing
- Resolved