Files
zulip/zephyr/static/js/signup.js
Keegan McAllister c1c8ce9e53 More style fixes for signup.js
(imported from commit 15303c4e0dbf342da752d5f215cbcb0e8c6652f5)
2012-10-04 11:05:34 -04:00

46 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var disallowed_domains = ['gmail.com'];
function validate_email_domain(value, element, param) {
var splitted = value.split("@");
var domain = splitted[splitted.length - 1];
return $.inArray(domain, disallowed_domains) !== -1;
}
$.validator.addMethod("fromDomain", validate_email_domain,
"Please use your company email address to sign up. Otherwise, we wont be able to connect you with your coworkers.");
$(function () {
$('#registration').validate({
errorElement: "p",
errorPlacement: function (error, element) {
console.log('hi');
error.appendTo(element.parent()).addClass('help-inline');
element.parent().parent().removeClass('success').addClass('error');
},
success: function (label) {
label.parent().parent().removeClass('error').addClass('success');
}
});
$("#email_signup").validate({
rules: {
email: {
required: true,
email: true
}
},
errorElement: "p",
errorClass: "validation-failed",
errorPlacement: function (error, element) {
$('#errors').empty();
element.parent().parent().removeClass('success').addClass('error');
error.appendTo("#errors")
.addClass("text-error");
},
success: function (label) {
label.parent().parent().removeClass('error').addClass('success');
}
});
});