Created
November 26, 2015 00:19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validation.add('validate-pobox','We cannot ship to your P.O. Please check the button to ship to a different address.',function(field_value) { | |
// setup a regex var for pretty much every possibility of PO box... | |
var regex = /[P|p]*(OST|ost)*\.*\s*[O|o|0]*(ffice|FFICE)*\.*\s*[B|b][O|o|0][X|x]/; | |
// if the field_value contains PO Box | |
if(field_value.match(regex)) | |
{ | |
if (document.getElementById('billing:use_for_shipping_yes').checked == true) | |
{ | |
return false; | |
} | |
return true; | |
} | |
else | |
{ | |
if(!field_value.match(regex)) | |
{ | |
return true; | |
} | |
} | |
}); | |
Validation.add('validate-pobox2','We cannot ship to your P.O. Please check the button to ship to a different address.',function(field_value) { | |
// setup a regex var for pretty much every possibility of PO box... | |
var regex2 = /[P|p]*(OST|ost)*\.*\s*[O|o|0]*(ffice|FFICE)*\.*\s*[B|b][O|o|0][X|x]/; | |
// if the field_value contains PO Box | |
if(field_value.match(regex2)) | |
{ | |
if (document.getElementById('billing:use_for_shipping_yes').checked == true) | |
{ | |
return false; | |
} | |
return true; | |
} | |
else | |
{ | |
if(!field_value.match(regex2)) | |
{ | |
return true; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment