Last active
December 15, 2015 10:59
-
-
Save eastridge/5249448 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Application.View.extend({ | |
name: "some-view", | |
events: { | |
"submit form": function(event) { | |
event.stopPropagation(); | |
$('error-messages-selector').empty(); | |
this.serialize(function(attr) { | |
}); | |
}, | |
error: function(errors) { | |
_.each(errors, function(e) { | |
$('label[for="' + e.name + '"]).addClass('error'); | |
$('error-messages-selector').append('<p>' + e.message + '</p>'); | |
}); | |
} | |
}, | |
validateInput: function(attrs) { | |
var errors = []; | |
if (attrs.title === '') { | |
errors.push({ | |
name: 'title', | |
message: 'cant be blank' | |
}); | |
} | |
return errors; | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment