This line reads: if(this.model == "edit") and I believe that should read: if(this.mode == "edit") instead