diff --git a/src/definitions/behaviors/form.js b/src/definitions/behaviors/form.js index 31709d0d2..148752d27 100644 --- a/src/definitions/behaviors/form.js +++ b/src/definitions/behaviors/form.js @@ -175,20 +175,19 @@ $.fn.form = function(fields, parameters) { $field .each(function () { var - $field = $(this), - type = $field.prop('type'), - name = $field.prop('name') + $field = $(this), + type = $field.prop('type'), + name = $field.prop('name'), + isCheckbox = $field.is(selector.checkbox), + isChecked = (isCheckbox) + ? $field.is(':checked') + : false ; - switch(type) { - case 'checkbox': - case 'radio': - if($field.is(':checked')) { - data[name] = $field.val(); - } - break; - default: - data[name] = $field.val(); + if(isCheckbox && !isChecked) { + module.debug('Omitted unchecked checkbox', $field); + return true; } + data[name] = $field.val(); }) ; return data;