Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Validation.add('validate-for-pobox','The shipping address must be a physical address. PO Boxes are allowed for billing only.',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)){
return false;
}
return true;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.