var EditProjectModal = ModalView.extend({ el: ".mediaDrawer.editProject", action: "/project/edit", events: { "submit form": "submit" }, initialize: function(){ this.$form = this.$("form") this.$errors = this.$(".errors") this.$errorList = this.$(".errorList") }, reset: function(){ this.$("input").not("[type='submit']").not("[type='hidden']").val("") }, load: function(){ this.reset() this.show() }, submit: function(e){ e.preventDefault() this.$errors.hide(); this.$errorList.empty() var fields = this.$form.serializeArray() var request = $.post(this.action, $.param(fields)); request.done($.proxy(function (response) { if (response.error) { this.$errors.show(); for (var key in response.error.errors) { this.$errorList.append('