From 612561818f907f0f9988247c82ec158ba4494986 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 24 Nov 2015 20:57:41 -0500 Subject: build --- .../platforms/ios/www/js/lib/nav/AddressView.js | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js (limited to 'StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js') diff --git a/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js b/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js new file mode 100644 index 00000000..15a5784d --- /dev/null +++ b/StoneIsland/platforms/ios/www/js/lib/nav/AddressView.js @@ -0,0 +1,39 @@ + +var AddressView = SerializableView.extend({ + + template: $("#address_template").html(), + + events: { + }, + + initialize: function(opt){ + this.parent = opt.parent + this.$el = this.parent.$(".address") + this.el = this.$el[0] + this.$el.html(this.template) + }, + + populate: function(data){ + this.parent.$(".address input").val("") + Object.keys(data).forEach(function(key){ + this.parent$(".address [name=" + key + "]").val(data[key]) + }.bind(this)) + }, + + deserialize: function(){ + }, + + validate_presence: { + "Name": "Please enter your first name.", + "Surname": "Please enter your last name.", + "Address1": "Please enter your street address.", + "City": "Please enter your city.", + "State": "Please choose your state.", + "Phone": "Please enter your phone number.", + }, + + validate_fields: function(data, errors){ + if (data.Phone.replace(/[^0-9]/g, "").length < 10) { errors.push([ "Phone", "Phone numbers must be at least 10 digits." ]) } + }, + +}) -- cgit v1.2.3-70-g09d2