1/* 2 This file contains validations that are too specific to be part of the core 3 Please reference the file AFTER the translation file or the rules will be overwritten 4 Use at your own risk. We can't provide support for most of the validations 5*/ 6(function($){ 7 if($.validationEngineLanguage == undefined || $.validationEngineLanguage.allRules == undefined ) 8 alert("Please include other-validations.js AFTER the translation file"); 9 else { 10 $.validationEngineLanguage.allRules["postcodeUK"] = { 11 // UK zip codes 12 "regex": /^([A-PR-UWYZa-pr-uwyz]([0-9]{1,2}|([A-HK-Ya-hk-y][0-9]|[A-HK-Ya-hk-y][0-9]([0-9]|[ABEHMNPRV-Yabehmnprv-y]))|[0-9][A-HJKS-UWa-hjks-uw])\ {0,1}[0-9][ABD-HJLNP-UW-Zabd-hjlnp-uw-z]{2}|([Gg][Ii][Rr]\ 0[Aa][Aa])|([Ss][Aa][Nn]\ {0,1}[Tt][Aa]1)|([Bb][Ff][Pp][Oo]\ {0,1}([Cc]\/[Oo]\ )?[0-9]{1,4})|(([Aa][Ss][Cc][Nn]|[Bb][Bb][Nn][Dd]|[BFSbfs][Ii][Qq][Qq]|[Pp][Cc][Rr][Nn]|[Ss][Tt][Hh][Ll]|[Tt][Dd][Cc][Uu]|[Tt][Kk][Cc][Aa])\ {0,1}1[Zz][Zz]))$/, 13 "alertText": "* Invalid postcode" 14 }; 15 $.validationEngineLanguage.allRules["postcodeNL"] = { 16 // NL zip codes | Accepts 1234AA format zipcodes 17 "regex": /^\d{4}[a-zA-Z]{2}?$/, 18 "alertText": "* Ongeldige postcode, formaat moet 1234AA zijn" 19 }; 20 $.validationEngineLanguage.allRules["postcodeUS"] = { 21 // US zip codes | Accepts 12345 and 12345-1234 format zipcodes 22 "regex": /^\d{5}(-\d{4})?$/, 23 "alertText": "* Invalid zipcode" 24 }; 25 $.validationEngineLanguage.allRules["postcodeDE"] = { 26 // Germany zip codes | Accepts 12345 format zipcodes 27 "regex": /^\d{5}?$/, 28 "alertText": "* Invalid zipcode" 29 }; 30 $.validationEngineLanguage.allRules["postcodeAT"] = { 31 // Austrian zip codes | Accepts 1234 format zipcodes 32 "regex": /^\d{4}?$/, 33 "alertText": "* Invalid zipcode" 34 }; 35 $.validationEngineLanguage.allRules["postcodePL"] = { 36 // Polish zip codes | Accepts 80-000 format zipcodes 37 "regex": /^\d{2}-\d{3}$/, 38 "alertText": "* Niepoprawny kod pocztowy, poprawny format to: 12-345" 39 }; 40 $.validationEngineLanguage.allRules["postcodeJP"] = { 41 // JP zip codes | Accepts 123 and 123-1234 format zipcodes 42 "regex": /^\d{3}(-\d{4})?$/, 43 "alertText": "* éµä¾¿çªå·ãæ£ããããã¾ãã" 44 }; 45 $.validationEngineLanguage.allRules["postcodeBR"] = { 46 // BR zip codes | Accepts 12345-123 format zipcodes 47 "regex": /^\d{5}(-\d{3})?$/, 48 "alertText": "* CEP inválido" 49 }; 50 $.validationEngineLanguage.allRules["onlyLetNumSpec"] = { 51 // Good for database fields 52 "regex": /^[0-9a-zA-Z_-]+$/, 53 "alertText": "* Only Letters, Numbers, hyphen(-) and underscore(_) allowed" 54 }; 55 // # more validations may be added after this point 56 57 58 59 // --- CUSTOM AZP RULES -- Those are specific to siteswift 60 $.validationEngineLanguage.allRules["dateDE"] = { 61 "regex": /^(((0[1-9]|[12][0-9]|3[01])([\.])(0[13578]|10|12)([\.])((19[0-9][0-9])|(2[0-9][0-9][0-9])))|(([0][1-9]|[12][0-9]|30)([\.])(0[469]|11)([\.])((19[0-9][0-9])|(2[0-9][0-9][0-9])))|((0[1-9]|1[0-9]|2[0-8])([\.])(02)([\.])((19[0-9][0-9])|(2[0-9][0-9][0-9])))|((29)([\.])(02)([\.])([02468][048]00))|((29)([\.])(02)([\.])([13579][26]00))|((29)([\.])(02)([\.])([0-9][0-9][0][48]))|((29)([\.])(02)([\.])([0-9][0-9][2468][048]))|((29)([\.])(02)([\.])([0-9][0-9][13579][26])))$/, 62 "alertText":"* Ungültiges Datumsformat, erwartet wird das Format TT.MM.JJJJ" 63 }; 64 $.validationEngineLanguage.allRules["dateTimeDE"] = { 65 "regex": /^(\d{2}.\d{2}.\d{4} \d{2}:\d{2})$/, 66 "alertText":"* Ungültiges Format, erwartet wird das Format TT.MM.JJJJ HH:MM" 67 }; 68 $.validationEngineLanguage.allRules["onlyNumber"] = { 69 "regex": /^[0-9\ ]+$/, 70 "alertText":"* Nur Zahlen erlaubt" 71 }; 72 $.validationEngineLanguage.allRules["onlyNumberSp"] = { 73 "regex": /^[0-9\ ]+$/,
74 "alertText": "* Nur Zahlen erlaubt" 75 }; 76 $.validationEngineLanguage.allRules["positiveInteger"] = { 77 "regex": /^\+?[1-9][0-9]*$/, 78 "alertText": "* nur positive ganze Zahlen erlaubt" 79 }; 80 $.validationEngineLanguage.allRules["positiveFloat"] = { 81 "regex": /^\+?(([0-9]+)([\.,]([0-9]+))?|([\.,]([0-9]+))?)$/, 82 "alertText": "* nur positive Zahlen erlaubt" 83 }; 84 $.validationEngineLanguage.allRules["timeDE"] = { 85 "regex": /([01]?[0-9]|2[0-3]):[0-5][0-9]/, 86 "alertText":"* Ungültiges Zeitformat, erwartet wird das Format HH:MM" 87 }; 88 $.validationEngineLanguage.allRules["funcCall[ibanChecksum]"] = { 89 "alertText": "* Ungültige IBAN" 90 }; 91 } 92})(jQuery); 93 94function ibanChecksum(field) { 95 var iban = field.val().replace(/\s+/g, '').toUpperCase(); 96 if (iban === '') return; 97 if (iban.length < 15 || iban.length > 34) return '* Ungültige IBAN'; 98 if (!/^[A-Z]{2}[0-9]{2}[A-Z0-9]+$/.test(iban)) return '* Ungültige IBAN'; 99 var rearranged = iban.substring(4) + iban.substring(0, 4); 100 var numStr = ''; 101 for (var j = 0; j < rearranged.length; j++) { 102 var code = rearranged.charCodeAt(j); 103 numStr += (code >= 65 && code <= 90) ? (code - 55).toString() : rearranged[j]; 104 } 105 var remainder = numStr; 106 while (remainder.length > 2) { 107 var block = remainder.substring(0, 9); 108 remainder = (parseInt(block, 10) % 97).toString() + remainder.substring(block.length); 109 } 110 if (parseInt(remainder, 10) % 97 !== 1) return '* Ungültige IBAN'; 111}
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.