Skip to content

Commit

Permalink
Fixing required/baselines settings not reading checked state properly…
Browse files Browse the repository at this point in the history
… - bug 15:resolved
  • Loading branch information
viveleroi committed Mar 2, 2013
1 parent a780f92 commit f0ce117
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.tmproj
nbproject
.ftpssh_settings
.idea
10 changes: 5 additions & 5 deletions js/jquery.formbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@
serialStr += opts.prepend + '[' + li_count + '][' + key + ']=' + encodeURIComponent($(this).attr(opts.attributes[att]));
// append the form field values
if (opts.attributes[att] === 'class') {
serialStr += opts.prepend + '[' + li_count + '][required]=' + encodeURIComponent($('#' + $(this).attr('id') + ' input.required').attr('checked'));
serialStr += opts.prepend + '[' + li_count + '][required]=' + encodeURIComponent($('#' + $(this).attr('id') + ' input.required').is(':checked'));
switch ($(this).attr(opts.attributes[att])) {
case 'input_text':
serialStr += opts.prepend + '[' + li_count + '][values]=' + encodeURIComponent($('#' + $(this).attr('id') + ' input[type=text]').val());
Expand All @@ -442,7 +442,7 @@
}
else {
serialStr += opts.prepend + '[' + li_count + '][values][' + c + '][value]=' + encodeURIComponent($(this).val());
serialStr += opts.prepend + '[' + li_count + '][values][' + c + '][baseline]=' + $(this).prev().attr('checked');
serialStr += opts.prepend + '[' + li_count + '][values][' + c + '][baseline]=' + $(this).prev().is(':checked');
}
c++;
});
Expand All @@ -455,21 +455,21 @@
}
else {
serialStr += opts.prepend + '[' + li_count + '][values][' + c + '][value]=' + encodeURIComponent($(this).val());
serialStr += opts.prepend + '[' + li_count + '][values][' + c + '][baseline]=' + $(this).prev().attr('checked');
serialStr += opts.prepend + '[' + li_count + '][values][' + c + '][baseline]=' + $(this).prev().is(':checked');
}
c++;
});
break;
case 'select':
c = 1;
serialStr += opts.prepend + '[' + li_count + '][multiple]=' + $('#' + $(this).attr('id') + ' input[name=multiple]').attr('checked');
serialStr += opts.prepend + '[' + li_count + '][multiple]=' + $('#' + $(this).attr('id') + ' input[name=multiple]').is(':checked');
$('#' + $(this).attr('id') + ' input[type=text]').each(function () {
if ($(this).attr('name') === 'title') {
serialStr += opts.prepend + '[' + li_count + '][title]=' + encodeURIComponent($(this).val());
}
else {
serialStr += opts.prepend + '[' + li_count + '][values][' + c + '][value]=' + encodeURIComponent($(this).val());
serialStr += opts.prepend + '[' + li_count + '][values][' + c + '][baseline]=' + $(this).prev().attr('checked');
serialStr += opts.prepend + '[' + li_count + '][values][' + c + '][baseline]=' + $(this).prev().is(':checked');
}
c++;
});
Expand Down

0 comments on commit f0ce117

Please sign in to comment.