[SUCS Devel] [Git][sucssite/sucs-site][master] 2 commits: Hopefully kill some JS errors

Laurence Sebastian Bowes elbows at sucs.org
Mon Nov 9 15:26:56 GMT 2015


Laurence Sebastian Bowes pushed to branch master at sucssite / sucs-site


Commits:
a7b59e82 by Laurence Sebastian Bowes at 2015-11-09T15:26:14Z
Hopefully kill some JS errors

- - - - -
d9387cf9 by Laurence Sebastian Bowes at 2015-11-09T15:26:30Z
what

Merge branch 'master' of https://projects.sucs.org/sucssite/sucs-site

- - - - -


1 changed file:

- htdocs/js/signup.js


Changes:

=====================================
htdocs/js/signup.js
=====================================
--- a/htdocs/js/signup.js
+++ b/htdocs/js/signup.js
@@ -72,21 +72,21 @@ function lookupSID(setname) {
         key = arr.shift();
         val = arr.join(":");
         if (key == "OK") {
-            if (setname = true)
+            if (setname === true)
                 $("input#realname").val(val);
             $('div#studentidmessage').attr("style", "color:green; float:right; clear:right;");
             $('div#studentidmessage').html(key);
-            validation['studentid'] = true;
+            validation.studentid = true;
             processName("realname", "realname");
 
         }
         else {
             $('div#studentidmessage').attr("style", "color:red; float:right; clear:right;");
             $('div#studentidmessage').html(val);
-            validation['email'] = false;
+            validation.email = false;
             validate();
         }
-    }, 'text')
+    }, 'text');
 }
 function processSID() {
     lookupSID(true);
@@ -96,15 +96,15 @@ function processUsername() {
     $.get("/signup/ajax", {key: "username", value: $('input#username').val()}, function (j) {
         if (j != "OK") {
             $('div#usernamemessage').attr("style", "color:red; float:right; clear:right;");
-            validation['username'] = false;
+            validation.username = false;
         }
         else {
             $('div#usernamemessage').attr("style", "color:green; float:right; clear:right;");
-            validation['username'] = true;
+            validation.username = true;
         }
         $('div#usernamemessage').html(j);
         validate();
-    }, 'text')
+    }, 'text');
 }
 
 function processName(type, input) {
@@ -119,7 +119,7 @@ function processName(type, input) {
         }
         $('div#' + input + 'message').html(j);
         validate();
-    }, 'text')
+    }, 'text');
 }
 function processContact() {
     processName('realname', 'contact');
@@ -129,45 +129,45 @@ function processAddress() {
     $.get("/signup/ajax", {key: "address", value: $('textarea#address').val()}, function (j) {
         if (j != "OK") {
             $('div#addressmessage').attr("style", "color:red; float:right; clear:right;");
-            validation['address'] = false;
+            validation.address = false;
         }
         else {
             $('div#addressmessage').attr("style", "color:green; float:right; clear:right;");
-            validation['address'] = true;
+            validation.address = true;
         }
         $('div#addressmessage').html(j);
         validate();
-    }, 'text')
+    }, 'text');
 }
 
 function processEmail() {
     $.get("/signup/ajax", {key: "email", value: $('input#email').val()}, function (j) {
         if (j != "OK") {
             $('div#emailmessage').attr("style", "color:red; float:right; clear:right;");
-            validation['email'] = false;
+            validation.email = false;
         }
         else {
             $('div#emailmessage').attr("style", "color:green; float:right; clear:right;");
-            validation['email'] = true;
+            validation.email = true;
         }
         $('div#emailmessage').html(j);
         validate();
-    }, 'text')
+    }, 'text');
 }
 
 function processPhone() {
     $.get("/signup/ajax", {key: "phone", value: $('input#phone').val()}, function (j) {
         if (j != "OK") {
             $('div#phonemessage').attr("style", "color:red; float:right; clear:right;");
-            validation['phone'] = false;
+            validation.phone = false;
         }
         else {
             $('div#phonemessage').attr("style", "color:green; float:right; clear:right;");
-            validation['phone'] = true;
+            validation.phone = true;
         }
         $('div#phonemessage').html(j);
         validate();
-    }, 'text')
+    }, 'text');
 }
 
 $(function () {
@@ -197,25 +197,25 @@ $(function () {
         $('div#postcodediv').removeAttr("style");
         $('input#submit').attr("disabled", "disabled");
         // if the fields are not empty validate them
-        if ($('input#username').val() != "") processUsername();
-        if ($('input#email').val() != "") processEmail();
-        if ($('input#phone').val() != "") processPhone();
-        if (usertype != 2) {
-            if ($('input#postcode').val() != "") processPostcode();
-            if ($('textarea#address').val() != "") processAddress();
-            if ($('input#realname').val() != "") processName("realname", "realname");
+        if ($('input#username').val() !== "") processUsername();
+        if ($('input#email').val() !== "") processEmail();
+        if ($('input#phone').val() !== "") processPhone();
+        if (usertype !== 2) {
+            if ($('input#postcode').val() !== "") processPostcode();
+            if ($('textarea#address').val() !== "") processAddress();
+            if ($('input#realname').val() !== "") processName("realname", "realname");
         }
         else {
-            if ($('input#contact').val() != "") processContact();
-            if ($('input#realname').val() != "") processName("socname", "realname");
+            if ($('input#contact').val() !== "") processContact();
+            if ($('input#realname').val() !== "") processName("socname", "realname");
         }
-        if ((usertype == 1) && ($('input#studentid').val() != "")) {
-            if ($('input#realname').val() == "") lookupSID(true);
+        if ((usertype == 1) && ($('input#studentid').val() !== "")) {
+            if ($('input#realname').val() === "") lookupSID(true);
             else lookupSID(false);
         }
 
         validate();
-    })
+    });
     // dont do address stuff for societies
     if (usertype != 2) {
         // process postcode when the box changes
@@ -235,21 +235,21 @@ $(function () {
             $("textarea#address").text(strUser);
             $('div#addressmessage').attr("style", "color:green; float:right; clear:right;");
             $('div#addressmessage').html("OK");
-            validation['address'] = true;
-        })
+            validation.address = true;
+        });
     }
     //else deal with the contact field
     else {
-        $("input#contact").change(processContact)
+        $("input#contact").change(processContact);
 
     }
     //if is a student
     if (usertype == 1) {
         //lookup the real name from the studentid
-        $("input#studentid").change(processSID)
+        $("input#studentid").change(processSID);
     }
     //validate username
-    $("input#username").change(processUsername)
+    $("input#username").change(processUsername);
     //validate personal and society names differntly
     if (usertype != 2) {
         persoc = 'realname';
@@ -260,7 +260,7 @@ $(function () {
     //validate real name
     $("input#realname").change(function () {
         processName(persoc, 'realname');
-    })
+    });
 
     //validate email address
     $("input#email").change(processEmail);
@@ -280,5 +280,5 @@ $(function () {
         }
         return valid;
     });
-})
+});
 



View it on GitLab: https://projects.sucs.org/sucssite/sucs-site/compare/ad9d9fb64447a4ad9ed1138927ecd066f6e24e09...d9387cf93a999eafa2614e0185e262f8c7e6a098
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sucs.org/pipermail/devel/attachments/20151109/190454e4/attachment-0001.html>


More information about the Devel mailing list