jQuery ValidationEngine and PO Box
http://stackoverflow.com/questions/16084500/jquery-validationengine-and-po-box/16127420#16127420
HTML
<script src="http://www.position-relative.net/creation/formValidator/js/jquery.validationEngine.js"></script>
<link rel="stylesheet" href="http://www.position-relative.net/creation/formValidator/css/validationEngine.jquery.css">
<link rel="stylesheet" href="http://www.position-relative.net/creation/formValidator/css/template.css">
<br/>
<br/>
<form id="pobox" method="post" action=".">
<input class="validate[required, custom[notPoBox]] text-input" type="text" id="ship_add1" name="ship_add2" value="" />
<input class="submit" type="submit" value="Validate & Send the form!" />
</form>
JavaScript
(function ($) {
$.fn.validationEngineLanguage = function () {};
$.validationEngineLanguage = {
newLang: function () {
$.validationEngineLanguage.allRules = {
"notPoBox": {
"func": function (field, rules, i, options) {
var isPoBox = /\b[p]*(ost)*\.*\s*[o|0]*(ffice)*\.*\s*b[o|0]x\b/i;
return !isPoBox.test(field.val());
},
"alertText": "* P.O. Box addresses are not allowed for shipping"
},
"required": { // Add your regex rules here, you can take telephone as an example
"regex": "none",
"alertText": "* This field is required",
"alertTextCheckboxMultiple": "* Please select an option",
"alertTextCheckboxe": "* This checkbox is required",
"alertTextDateRange": "* Both date range fields are required"
},
"requiredInFunction": {
"func": function (field, rules, i, options) {
return (field.val() == "test") ? true : false;
},
"alertText": "* Field must equal test"
},
"dateRange": {
"regex": "none",
"alertText": "* Invalid ",
"alertText2": "Date Range"
},
"dateTimeRange": {
"regex": "none",
"alertText": "* Invalid ",
"alertText2": "Date Time Range"
},
"minSize": {
"regex": "none",
"alertText": "* Minimum ",
"alertText2": " characters allowed"
},
"maxSize": {
"regex": "none",
...