From 53c84d93da0f0681fdcb3a061ebe529fd3cd9a9e Mon Sep 17 00:00:00 2001 From: Brian Cairns Date: Mon, 12 Jun 2017 16:16:55 -0600 Subject: [PATCH] Fix changetracker checkbox bugs 1) Use quoted name attribute selector, to work with CheckboxsetField bracketed[] field names 2) Initialize unchecked boxes original values to 0 instead of undefined, as this is the value onchange() expects for unchecked boxes (see line 67) --- .../jquery-changetracker/lib/jquery.changetracker.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/admin/javascript/jquery-changetracker/lib/jquery.changetracker.js b/admin/javascript/jquery-changetracker/lib/jquery.changetracker.js index 80ed74efc..df7853ceb 100644 --- a/admin/javascript/jquery-changetracker/lib/jquery.changetracker.js +++ b/admin/javascript/jquery-changetracker/lib/jquery.changetracker.js @@ -92,7 +92,10 @@ fields.not(':radio,:checkbox').bind('change.changetracker', onchange); fields.each(function() { if($(this).is(':radio,:checkbox')) { - origVal = self.find(':input[name=' + $(this).attr('name') + ']:checked').val(); + origVal = self.find(':input[name="' + $(this).attr('name') + '"]:checked').val(); + if("undefined" === typeof origVal){ + origVal = 0; + } } else { origVal = $(this).val(); }