Browse Source

#1630 - Formatting on form serialize

pull/1698/merge
jlukic 9 years ago
parent
commit
1bb3fe04ef
1 changed files with 11 additions and 12 deletions
  1. 23
      src/definitions/behaviors/form.js

23
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;

Loading…
Cancel
Save