Skip to content

Commit b2fb325

Browse files
committed
Fix for checkboxes and radio buttons not triggering form change event (thanks @abecks)
1 parent 1788ca1 commit b2fb325

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

autoform-events.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,18 @@ Template.autoForm.events({
397397
// loops by continually saying the field changed when it did not,
398398
// especially in an autosave situation. This is an attempt to
399399
// prevent that from happening.
400-
var keyVal = key + '___' + event.target.value;
400+
var keyVal;
401+
switch(event.target.type){
402+
case 'checkbox':
403+
case 'radio':
404+
keyVal = $(event.target).prop('checked');
405+
break;
406+
default:
407+
keyVal = event.target.value;
408+
}
409+
410+
keyVal = key + '___' + keyVal;
411+
401412
if (keyVal === lastKeyVal) {
402413
return;
403414
}

0 commit comments

Comments
 (0)