Skip to content

Instantly share code, notes, and snippets.

@theozaurus
Forked from mrmason/gist:902659
Created April 4, 2011 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save theozaurus/902662 to your computer and use it in GitHub Desktop.
Save theozaurus/902662 to your computer and use it in GitHub Desktop.
var nameserver = /^((([a-z0-9]([a-z0-9\-]{0,61}[a-z0-9])?\.)+[a-z]{2,6})|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))$/i;
$('#configure_domains_form').submit(function() {
return $('input[name^="domainns"]').each(function(){
if(nameserver.test($(this).val())){
// Do nothing
}
else{
if ($(this).val() == ""){
if($(this).attr("name") == "domainns3" || $(this).attr("name") == "domainns4"){
// Do nothing, it's ok for these to be Blank
}
else{
alert($(this).attr("name") + ": Cannot be blank - you need 2 Nameservers. If in doubt, please use n1.krystal.co.uk and ns2.krystal.co.uk");
return false;
}
}else{
alert($(this).val() + " is not a valid nameserver : " + $(this).attr("name"));
return false;
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment