Skip to content

Commit

Permalink
Fix #81 [helper][form-binder] Correct the case checkbox:selected -> c…
Browse files Browse the repository at this point in the history
…heckbox:empty triggering no changes.
  • Loading branch information
pierr committed Feb 6, 2015
1 parent 96c76b8 commit c330acf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/helpers/form_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,13 @@ var _formInputModelBinder = function formInputModelBinder(inputs, model, options
}

if (input.multiple) {
// Init field values array.
if (modelContainer[this.getAttribute('data-name')] === undefined) {
modelContainer[this.getAttribute('data-name')] = [];
}
/* Add value if checked. */
if (input.checked) {
if (modelContainer[this.getAttribute('data-name')] === undefined) {
modelContainer[this.getAttribute('data-name')] = [currentvalue];
} else {
modelContainer[this.getAttribute('data-name')].push(currentvalue);
}
modelContainer[this.getAttribute('data-name')].push(currentvalue);
}
} else {
modelContainer[this.getAttribute('data-name')] = currentvalue;
Expand Down

0 comments on commit c330acf

Please sign in to comment.