var CreditCardView = View.extend({ template: $("#creditcard_template").html(), events: { }, initialize: function(opt){ this.parent = opt.parent this.setElement( this.parent.$(".cc") ) this.parent.$(".cc").html(this.template) }, populate: function(data){ this.parent.$(".cc input").val("") this.$(".cc input").val("") this.load_data(data) }, validate_presence: { 'Number': 'Please enter your credit card number.', 'CVV': 'Please enter your security code.', }, validate_fields: function(data, errors){ if (! data.ExpirationMonth || data.ExpirationMonth == "NONE") { errors.push([ "ExpirationMonth", "Please enter the expiration month." ]) } if (! data.ExpirationYear || data.ExpirationYear == "NONE") { errors.push([ "ExpirationYear", "Please select the expiration month." ]) } data.UserId = auth.user_id }, })