Skip to content
Commits on Source (2)
......@@ -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;
});
})
});