1(function($){ 2 $.fn.validationEngineLanguage = function(){ 3 }; 4 $.validationEngineLanguage = { 5 newLang: function(){ 6 $.validationEngineLanguage.allRules = { 7 "required": { // Add your regex rules here, you can take telephone as an example 8 "regex": "none", 9 "alertText": "* This field is required", 10 "alertTextCheckboxMultiple": "* Please select an option", 11 "alertTextCheckboxe": "* This checkbox is required", 12 "alertTextDateRange": "* Both date range fields are required" 13 }, 14 "requiredInFunction": { 15 "func": function(field, rules, i, options){ 16 return (field.val() == "test") ? true : false; 17 }, 18 "alertText": "* Field must equal test" 19 }, 20 "dateRange": { 21 "regex": "none", 22 "alertText": "* Invalid date range" 23 /*,"alertText2": "Date Range"*/ 24 }, 25 "dateTimeRange": { 26 "regex": "none", 27 "alertText": "* Invalid time range" 28 /*,"alertText2": "Date Time Range"*/ 29 }, 30 "minSize": { 31 "regex": "none", 32 "alertText": "* You must enter a minimum of ", 33 "alertText2": " characters" 34 }, 35 "maxSize": { 36 "regex": "none", 37 "alertText": "* You can only enter a maximum of ", 38 "alertText2": " characters" 39 }, 40 "groupRequired": { 41 "regex": "none", 42 "alertText": "* You must check at least one of the following options", 43 "alertTextCheckboxMultiple": "* Please select an option", 44 "alertTextCheckboxe": "* This checkbox is required" 45 }, 46 "min": { 47 "regex": "none", 48 "alertText": "* Minimum value is " 49 }, 50 "max": { 51 "regex": "none", 52 "alertText": "* Maximum value is " 53 }, 54 "past": { 55 "regex": "none", 56 "alertText": "* Date prior to " 57 }, 58 "link": { 59 "regex": /^[0-9a-zA-Z-_]+$/, 60 "alertText": "* Only A-Z, 0-9, underscores and hypens are allowed", 61 }, 62 "future": { 63 "regex": "none", 64 "alertText": "* Date past " 65 }, 66 "maxCheckbox": { 67 "regex": "none", 68 "alertText": "* You can only check a maximum of ", 69 "alertText2": " options" 70 }, 71 "minCheckbox": { 72 "regex": "none", 73 "alertText": "* Please select ", 74 "alertText2": " options" 75 }, 76 "equals": { 77 "regex": "none", 78 "alertText": "* Fields do not match" 79 }, 80 "creditCard": { 81 "regex": "none", 82 "alertText": "* Invalid credit card number" 83 }, 84 "phone": { 85 // credit: jquery.h5validate.js / orefalo 86 "regex": /^([\+][0-9]{1,3}([ \.\-])?)?([\(][0-9]{1,6}[\)])?([0-9 \.\-]{1,32})(([A-Za-z \:]{1,11})?[0-9]{1,4}?)$/, 87 "alertText": "* Invalid phone number" 88 }, 89 "email": { 90 // HTML5 compatible email regex ( http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html# e-mail-state-%28type=email%29 ) 91 "regex": /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/, 92 "alertText": "* Invalid email address" 93 }, 94 "fullname": { 95 "regex":/^([a-zA-Z]+[\'\,\.\-]?[a-zA-Z ]*)+[ ]([a-zA-Z]+[\'\,\.\-]?[a-zA-Z ]+)+$/, 96 "alertText":"* Please enter your first and last name" 97 }, 98 "zip": { 99 "regex":/^\d{5}$|^\d{5}-\d{4}$/, 100 "alertText":"* Invalid zip format" 101 }, 102 "integer": { 103 "regex": /^[\-\+]?\d+$/, 104 "alertText": "* This is not a valid number" 105 }, 106 "number": { 107 // Number, including positive, negative, and floating decimal. credit: orefalo 108 "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, 109 "alertText": "* This is not a valid number" 110 }, 111 "date": { 112 // Check if date is valid by leap year 113 "func": function (field) { 114 var pattern = new RegExp(/^(\d{4})[\/\-\.](0?[1-9]|1[012])[\/\-\.](0?[1-9]|[12][0-9]|3[01])$/); 115 var match = pattern.exec(field.val()); 116 if (match == null) 117 return false; 118 119 var year = match[1];
120 var month = match[2]*1; 121 var day = match[3]*1; 122 var date = new Date(year, month - 1, day); // because months starts from 0. 123 124 return (date.getFullYear() == year && date.getMonth() == (month - 1) && date.getDate() == day); 125 }, 126 "alertText": "* Invalid date, must be in YYYY-MM-DD format" 127 }, 128 "ipv4": { 129 "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/, 130 "alertText": "* Invalid IP address" 131 }, 132 "url": { 133 "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i, 134 "alertText": "* Invalid URL" 135 }, 136 "onlyNumberSp": { 137 "regex": /^[0-9\ ]+$/, 138 "alertText": "* You can only enter numbers" 139 }, 140 "onlyLetterSp": { 141 "regex": /^[a-zA-Z\ \']+$/, 142 "alertText": "* You can only enter letters" 143 }, 144 "onlyLetterAccentSp":{ 145 "regex": /^[a-z\u00C0-\u017F\ ]+$/i, 146 "alertText": "* You can only enter letters (accents allowed)" 147 }, 148 "onlyLetterNumber": { 149 "regex": /^[0-9a-zA-Z]+$/, 150 "alertText": "* No special characters allowed" 151 }, 152 // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings 153 "ajaxUserCall": { 154 "url": "ajaxValidateFieldUser", 155 // you may want to pass extra data on the ajax call 156 "extraData": "name=eric", 157 "alertText": "* Sorry, this username is already taken", 158 "alertTextLoad": "* Validating, please wait" 159 }, 160 "ajaxUserCallPhp": { 161 "url": "phpajax/ajaxValidateFieldUser.php", 162 // you may want to pass extra data on the ajax call 163 "extraData": "name=eric", 164 // if you provide an "alertTextOk", it will show as a green prompt when the field validates 165 "alertTextOk": "* This username is available", 166 "alertText": "* Sorry, this username is already taken", 167 "alertTextLoad": "* Validating, please wait" 168 }, 169 "ajaxNameCall": { 170 // remote json service location 171 "url": "ajaxValidateFieldName", 172 // error 173 "alertText": "* This name is already taken", 174 // if you provide an "alertTextOk", it will show as a green prompt when the field validates 175 "alertTextOk": "* This name is available", 176 // speaks by itself 177 "alertTextLoad": "* Validating, please wait" 178 }, 179 "ajaxNameCallPhp": { 180 // remote json service location 181 "url": "phpajax/ajaxValidateFieldName.php", 182 // error 183 "alertText": "* This name is already taken", 184 // speaks by itself 185 "alertTextLoad": "* Validating, please wait" 186 }, 187 "validate2fields": { 188 "alertText": "* Please input HELLO" 189 }, 190 //tls warning:homegrown not fielded 191 "dateFormat":{ 192 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?
192:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/, 193 "alertText": "* Invalid Date" 194 }, 195 //tls warning:homegrown not fielded 196 "dateTimeFormat": { 197 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/, 198 "alertText": "* Invalid Date or Date Format", 199 "alertText2": "Expected Format: ", 200 "alertText3": "mm/dd/yyyy hh:mm:ss AM|PM or ", 201 "alertText4": "yyyy-mm-dd hh:mm:ss AM|PM" 202 } 203 }; 204 205 } 206 }; 207 208 $.validationEngineLanguage.newLang(); 209 210})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.