Views.Text = Views.Base.extend({ classType: "Views.Text", tagName: "div", _rows: 4, _contentPattern: "", listenEvents: function() { //See Views.Base listenDefaultEvents() /*this.on("onKeyUp", function(event) { //console.log("onKeyUp received by Views.Text", event); this.updateModelFromInput(event); });*/ }, triggerEventsOn: function() { //See Views.Base launchDefaultActionsOn() }, triggerAddModelToCollectionOn: function() { var that = this; this.$el.on("change", function(event) { that.trigger("onaddmodeltocollection"); }); }, /*postComputeOnError : function () { if (this._contentPattern != "") { var regExp = new RegExp(this._contentPattern); return !regExp.test(this.model.get("value")); } return false; },*/ resetAddEl: function() { $("#autocomplete_" + this.id).remove(); this.$el.val(""); }, resetEl: function() { this.$el.val(""); } }); Views.TextList = Views.BaseList.extend({ classType: "Views.TextList", resetEl: function() { var that = this; var addAction = this.options.actions.add; if (addAction.view) { addAction.view.resetAddEl(); } this.model.each(function(item) { var view = item.view; if (view) { view.$el.on("change", function(event) { if ($(this).val() == "") { that.model.remove(view.model); } }); } }); } });