Skip to content

Commit

Permalink
netteForms.js: toggleControl() binds events on all inputs [Closes #75]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed May 6, 2015
1 parent adb6b9f commit e69a7b8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/assets/netteForms.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,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]);
}
Expand Down

0 comments on commit e69a7b8

Please sign in to comment.