Skip to content

Commit

Permalink
Fixed issues around validation marionettejs#38
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Walton committed Oct 1, 2016
1 parent b8e490e commit 6e7c648
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions en/getting_started/tutorial/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,12 @@ var TodoList = Marionette.CompositeView.extend({
this.model.set({
assignee: this.ui.assignee.val(),
text: this.ui.text.val()
}, {validate: true});
});

var items = this.model.pick('assignee', 'text');
this.collection.add(items);
if (this.model.isValid()) {
var items = this.model.pick('assignee', 'text');
this.collection.add(items);
}
},

itemAdded: function() {
Expand Down Expand Up @@ -345,10 +347,12 @@ var TodoList = Marionette.CompositeView.extend({
this.model.set({
assignee: this.ui.assignee.val(),
text: this.ui.text.val()
}, {validate: true});
});

var items = this.model.pick('assignee', 'text');
this.collection.add(items);
if (this.model.isValid()) {
var items = this.model.pick('assignee', 'text');
this.collection.add(items);
}
},

itemAdded: function() {
Expand Down

0 comments on commit 6e7c648

Please sign in to comment.