Author: jcompagner Date: Mon Mar 24 08:17:48 2008 New Revision: 640441 URL: http://svn.apache.org/viewvc?rev=640441&view=rev Log: applied patch from WICKET-1332 AjaxFormChoiceComponentUpdatingBehavior just updates the group "grandchildren"
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java?rev=640441&r1=640440&r2=640441&view=diff ============================================================================== --- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java (original) +++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java Mon Mar 24 08:17:48 2008 @@ -61,18 +61,15 @@ super.renderHead(response); AppendingStringBuffer asb = new AppendingStringBuffer(); - asb.append("function attachChoiceHandlers(markupid, callbackscript) {\n"); - asb.append(" var choiceElementGroup = document.getElementById(markupid);\n"); - asb.append(" for( var x = 0; x < choiceElementGroup.childNodes.length; x++ ) {\n"); - asb.append(" var choiceElementList = choiceElementGroup.childNodes[x];"); - asb.append(" for( var y = 0; y < choiceElementList.childNodes.length; y++ ) {\n"); - asb.append(" if (choiceElementList.childNodes[y] && choiceElementList.childNodes[y].tagName) {\n"); - asb.append(" var tag = choiceElementList.childNodes[y].tagName.toLowerCase();\n"); - asb.append(" if (tag == 'input') {\n"); - asb.append(" Wicket.Event.add(choiceElementList.childNodes[y],'click', callbackscript);"); - asb.append(" }\n"); - asb.append(" }\n"); - asb.append(" }\n"); + asb.append("function attachChoiceHandlers(markupId, callbackScript) {\n"); + asb.append(" var inputNodes = wicketGet(markupId).getElementsByTagName('input');\n"); + asb.append(" for (var i = 0 ; i < inputNodes.length ; i ++) {\n"); + asb.append(" var inputNode = inputNodes[i];\n"); + asb.append(" if (!inputNode.type) continue;\n"); + asb.append(" var inputType = inputNode.type.toLowerCase();\n"); + asb.append(" if (inputType == 'check' || inputType == 'radio') {\n"); + asb.append(" Wicket.Event.add(inputNode, 'click', callbackScript);\n"); + asb.append(" }\n"); asb.append(" }\n"); asb.append("}\n");