Skip to content

Commit

Permalink
Set values to false for unset checkboxes and radio buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
scien authored and François Daoust committed Jun 4, 2013
1 parent 1bf2a48 commit 8d3bb01
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/jsonform.js
Original file line number Diff line number Diff line change
Expand Up @@ -2228,6 +2228,14 @@ formNode.prototype.getFormValues = function (updateArrayPath) {
// Form fields values
var formArray = $(':input', this.el).serializeArray();

// Set values to false for unset checkboxes and radio buttons
// because serializeArray() ignores them
formArray = formArray.concat(
$(':input[type=checkbox]:not(:checked)', this.el).map( function() {
return {"name": this.name, "value": this.checked}
}).get()
);

if (updateArrayPath) {
_.each(formArray, function (param) {
param.name = applyArrayPath(param.name, updateArrayPath);
Expand Down

0 comments on commit 8d3bb01

Please sign in to comment.