diff --git a/src/definitions/behaviors/form.js b/src/definitions/behaviors/form.js index 148752d27..0dc43fc9b 100644 --- a/src/definitions/behaviors/form.js +++ b/src/definitions/behaviors/form.js @@ -178,16 +178,30 @@ $.fn.form = function(fields, parameters) { $field = $(this), type = $field.prop('type'), name = $field.prop('name'), + value = $field.val(), isCheckbox = $field.is(selector.checkbox), + isRadio = $field.is(selector.radio), isChecked = (isCheckbox) ? $field.is(':checked') : false ; - if(isCheckbox && !isChecked) { - module.debug('Omitted unchecked checkbox', $field); - return true; + if(isRadio) { + if(isChecked) { + data[name] = value; + } + } + else if(isCheckbox) { + if(isChecked) { + data[name] = true; + } + else { + module.debug('Omitted unchecked checkbox', $field); + return true; + } + } + else { + data[name] = value; } - data[name] = $field.val(); }) ; return data;