From 1d22a86c1a193f735740cb5a4a944906217d2341 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Wed, 6 May 2015 20:07:07 +0200 Subject: [PATCH] netteForms.js: toggleControl() binds events on all inputs [Closes #75] --- src/assets/netteForms.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/assets/netteForms.js b/src/assets/netteForms.js index 73c9488a1..81cf84bb4 100644 --- a/src/assets/netteForms.js +++ b/src/assets/netteForms.js @@ -467,10 +467,11 @@ Nette.toggleControl = function(elem, rules, success, firsttime, value) { has = true; if (firsttime) { var oldIE = !document.addEventListener, // IE < 9 - els = curElem.tagName ? [curElem] : curElem; // is radiolist? + name = curElem.tagName ? curElem.name : curElem[0].name, + els = curElem.tagName ? curElem.form.elements : curElem; for (var i = 0; i < els.length; i++) { - if (!Nette.inArray(handled, els[i])) { + if (els[i].name === name && !Nette.inArray(handled, els[i])) { Nette.addEvent(els[i], oldIE && curElem.type in {checkbox: 1, radio: 1} ? 'click' : 'change', handler); handled.push(els[i]); }