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 ", 23 "alertText2": "Date Range" 24 }, 25 "dateTimeRange": { 26 "regex": "none", 27 "alertText": "* Invalid ", 28 "alertText2": "Date Time Range" 29 }, 30 "minSize": { 31 "regex": "none", 32 "alertText": "* Minimum ", 33 "alertText2": " characters allowed" 34 }, 35 "maxSize": { 36 "regex": "none", 37 "alertText": "* Maximum ", 38 "alertText2": " characters allowed" 39 }, 40 "groupRequired": { 41 "regex": "none", 42 "alertText": "* You must fill one of the following fields" 43 }, 44 "min": { 45 "regex": "none", 46 "alertText": "* Minimum value is " 47 }, 48 "max": { 49 "regex": "none", 50 "alertText": "* Maximum value is " 51 }, 52 "past": { 53 "regex": "none", 54 "alertText": "* Date prior to " 55 }, 56 "future": { 57 "regex": "none", 58 "alertText": "* Date past " 59 }, 60 "maxCheckbox": { 61 "regex": "none", 62 "alertText": "* Maximum ", 63 "alertText2": " options allowed" 64 }, 65 "minCheckbox": { 66 "regex": "none", 67 "alertText": "* Please select ", 68 "alertText2": " options" 69 }, 70 "equals": { 71 "regex": "none", 72 //"alertText": "* Fields do not match" 73 "alertText": "* Please match the previous control content." 74 }, 75 "creditCard": { 76 "regex": "none", 77 "alertText": "* Invalid credit card number" 78 }, 79 "phone": { 80 // credit: jquery.h5validate.js / orefalo 81 "regex": /^([\+][0-9]{1,3}[\ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9\ \.\-\/]{3,20})((x|ext|extension)[\ ]?[0-9]{1,4})?$/, 82 "alertText": "* Invalid phone number" 83 }, 84 "email": { 85 // 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 ) 86 "regex": /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/, 87 "alertText": "* Invalid email address" 88 }, 89 "integer": { 90 "regex": /^[\-\+]?\d+$/, 91 "alertText": "* Not a valid integer" 92 }, 93 "number": { 94 // Number, including positive, negative, and floating decimal. credit: orefalo 95 "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/, 96 "alertText": "* Invalid floating decimal number" 97 }, 98 "date": { 99 // Check if date is valid by leap year 100 "func": function (field) { 101 var pattern = new RegExp(/^(\d{4})[\/\-\.](0?[1-9]|1[012])[\/\-\.](0?[1-9]|[12][0-9]|3[01])$/); 102 var match = pattern.exec(field.val()); 103 if (match == null) 104 return false; 105 106 var year = match[1];
107 var month = match[2]*1; 108 var day = match[3]*1; 109 var date = new Date(year, month - 1, day); // because months starts from 0. 110 111 return (date.getFullYear() == year && date.getMonth() == (month - 1) && date.getDate() == day); 112 }, 113 "alertText": "* Invalid date, must be in YYYY-MM-DD format" 114 }, 115 "ipv4": { 116 "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]))$/, 117 "alertText": "* Invalid IP address" 118 }, 119 "url": { 120 "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, 121 "alertText": "* Invalid URL" 122 }, 123 "onlyNumberSp": { 124 "regex": /^[0-9\ ]+$/, 125 "alertText": "* Numbers only" 126 }, 127 "onlyLetterSp": { 128 "regex": /^[a-zA-Z\ \']+$/, 129 "alertText": "* Letters only" 130 }, 131 "onlyLetterNumber": { 132 "regex": /^[0-9a-zA-Z]+$/, 133 "alertText": "* No special characters allowed" 134 }, 135 // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings 136 "ajaxFieldName": { 137 "extraData": "type=FieldName", 138 "alertTextOk": "* This field name is available", 139 "alertTextLoad": "* Validating, please wait", 140 "alertText": "* This field name is already taken" 141 }, 142 "ajaxUpload": { 143 "extraData": "type=Upload", 144 "alertTextOk": "* uploading the file is allowed.", 145 "alertTextLoad": "* Validating, please wait", 146 "alertText": "* uploading the file is not allowed" 147 }, 148 149 // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings 150 "ajaxUserCall": { 151 "url": "ajaxValidateFieldUser", 152 // you may want to pass extra data on the ajax call 153 "extraData": "name=eric", 154 "alertText": "* This user is already taken", 155 "alertTextLoad": "* Validating, please wait" 156 }, 157 "ajaxUserCallPhp": { 158 "url": "phpajax/ajaxValidateFieldUser.php", 159 // you may want to pass extra data on the ajax call 160 "extraData": "name=eric", 161 // if you provide an "alertTextOk", it will show as a green prompt when the field validates 162 "alertTextOk": "* This username is available", 163 "alertText": "* This user is already taken", 164 "alertTextLoad": "* Validating, please wait" 165 }, 166 "ajaxNameCall": { 167 // remote json service location 168 "url": "ajaxValidateFieldName", 169 // error 170 "alertText": "* This name is already taken", 171 // if you provide an "alertTextOk", it will show as a green prompt when the field validates 172 "alertTextOk": "* This name is available", 173 // speaks by itself 174 "alertTextLoad": "* Validating, please wait" 175 }, 176 "ajaxNameCallPhp": { 177 // remote json service location 178 "url": "phpajax/ajaxValidateFieldName.php", 179 // error 180 "alertText": "* This name is already taken", 181 // speaks by itself 182 "alertTextLoad": "* Validating, please wait" 183 }, 184 "validate2fields": { 185 "alertText": "* Please input HELLO" 186 }, 187 //tls warning:homegrown not fielded 188 "dateFormat":{ 189 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?
189: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]))$/, 190 "alertText": "* Invalid Date" 191 }, 192 //tls warning:homegrown not fielded 193 "dateTimeFormat": { 194 "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})$/, 195 "alertText": "* Invalid Date or Date Format", 196 "alertText2": "Expected Format: ", 197 "alertText3": "mm/dd/yyyy hh:mm:ss AM|PM or ", 198 "alertText4": "yyyy-mm-dd hh:mm:ss AM|PM" 199 } 200 }; 201 202 } 203 }; 204 205 $.validationEngineLanguage.newLang(); 206 207})(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.