var ProfileView = FormView.extend({ el: "#profile", events: { }, initialize: function(){ this.$form = this.$("form") this.$msg = this.$(".msg") this.scroller = new IScroll('#profile', app.iscroll_options) }, show: function(){ app.footer.show("SAVE", "CANCEL") document.body.className = "profile" }, validate_presence: { "Name": "Please enter your first name.", "Surname": "Please enter your last name.", "Email": "Please enter a valid email address.", }, validate_fields: function(data, errors){ if (! data.CurrentPassword && data.NewPassword) { errors.push([ "CurrentPassword", "Please enter your current password." ]) } if (data.CurrentPassword && ! data.NewPassword) { errors.push([ "NewPassword", "Please enter your new password." ]) } if (data.NewPassword && data.NewPassword.length < 7) { errors.push([ "CurrentPassword", "New password must be 7 characters or more." ]) } }, success: function(data){ }, error: function(data){ }, })