[
https://issues.apache.org/jira/browse/WICKET-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Igor Vaynberg resolved WICKET-1258.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.3.1
Assignee: Igor Vaynberg (was: Johan Compagner)
> AjaxFormChoiceComponentUpdatingBehavior assumes Radio/Choice items are a
> direct child of the group in the client-side DOM
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: WICKET-1258
> URL: https://issues.apache.org/jira/browse/WICKET-1258
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.3.0-final
> Reporter: Matt Clark
> Assignee: Igor Vaynberg
> Fix For: 1.3.1
>
>
> 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");
> 70) asb.append(" Wicket.Event.add(choiceElement.childNodes[x],'click',
> callbackscript);");
> 71) asb.append(" }\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?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.