JAVASCRIPT   94

other-validations.js

Guest on 29th August 2021 05:54:21 PM

  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["postcodeUS"] = {
  16.                         // US zip codes | Accepts 12345 and 12345-1234 format zipcodes
  17.                 "regex": /^\d{5}(-\d{4})?$/,
  18.                 "alertText": "* Invalid zipcode"
  19.                 };
  20.                 $.validationEngineLanguage.allRules["postcodeDE"] = {
  21.                         // Germany zip codes | Accepts 12345 format zipcodes
  22.                 "regex": /^\d{5}?$/,
  23.                 "alertText": "* Invalid zipcode"
  24.                 };
  25.                 $.validationEngineLanguage.allRules["postcodeAT"] = {
  26.                         // Austrian zip codes | Accepts 1234 format zipcodes
  27.                 "regex": /^\d{4}?$/,
  28.                 "alertText": "* Invalid zipcode"
  29.                 };
  30.     $.validationEngineLanguage.allRules["postcodeJP"] = {
  31.       // JP zip codes | Accepts 123 and 123-1234 format zipcodes
  32.       "regex": /^\d{3}(-\d{4})?$/,
  33.       "alertText": "* 郵ä¾æē•Ŗå¸·ćŒę­£ć—ć¸ć‚ć‚Šć¾ć›ć‚“"—ć¸ć‚ć‚Šć¾ć›ć‚“"
  34.     };
  35.                 $.validationEngi// Good for database fields
  36. NumSpec"] = {
  37.                                 // Good for database fields
  38.                                 "* Only Letters, Numbers, hyphen(-) and underscore(_) allowed" Number// # more validations may be added after this point
  39. ore validation

Raw Paste


Login or Register to edit or fork this paste. It's free.