From e474ead4fde530b1cb52f96e827269371120cb89 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 12 Nov 2015 00:14:04 -0500 Subject: form serialization class --- StoneIsland/www/js/lib/account/SignupView.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'StoneIsland/www/js/lib/account/SignupView.js') diff --git a/StoneIsland/www/js/lib/account/SignupView.js b/StoneIsland/www/js/lib/account/SignupView.js index d8459f9b..e695e26f 100644 --- a/StoneIsland/www/js/lib/account/SignupView.js +++ b/StoneIsland/www/js/lib/account/SignupView.js @@ -18,6 +18,18 @@ var SignupView = SerializableView.extend({ document.body.className = "signup" }, + validate: function(data){ + var errors = [] + if (! data.Name) { errors.push("Please enter your first name.") } + if (! data.Surname) { errors.push("Please enter your last name.") } + if (! data.Email) { errors.push("Please enter a valid email address.") } + if (! data.Password) { errors.push("Please enter your password.") } + if (! data.Password2) { errors.push("Please enter your password again.") } + if (data.Password !== data.Password2) { errors.push("Passwords don't match.") } + if (! data.DataProfiling) { errors.push("You must agree to share your data.") } + return errors + }, + save: function(e){ e && e.preventDefault() }, -- cgit v1.2.3-70-g09d2