Server IP : 162.0.232.140 / Your IP : 3.143.203.223 Web Server : LiteSpeed System : Linux premium139.web-hosting.com 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64 User : micrcvoy ( 740) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/micrcvoy/public_html/controlPanel/assets/plugins/jquery-validation/src/additional/ |
Upload File : |
/* Validates US States and/or Territories by @jdforsythe * Can be case insensitive or require capitalization - default is case insensitive * Can include US Territories or not - default does not * Can include US Military postal abbreviations (AA, AE, AP) - default does not * * Note: "States" always includes DC (District of Colombia) * * Usage examples: * * This is the default - case insensitive, no territories, no military zones * stateInput: { * caseSensitive: false, * includeTerritories: false, * includeMilitary: false * } * * Only allow capital letters, no territories, no military zones * stateInput: { * caseSensitive: false * } * * Case insensitive, include territories but not military zones * stateInput: { * includeTerritories: true * } * * Only allow capital letters, include territories and military zones * stateInput: { * caseSensitive: true, * includeTerritories: true, * includeMilitary: true * } * * * */ $.validator.addMethod("stateUS", function(value, element, options) { var isDefault = typeof options === "undefined", caseSensitive = ( isDefault || typeof options.caseSensitive === "undefined" ) ? false : options.caseSensitive, includeTerritories = ( isDefault || typeof options.includeTerritories === "undefined" ) ? false : options.includeTerritories, includeMilitary = ( isDefault || typeof options.includeMilitary === "undefined" ) ? false : options.includeMilitary, regex; if (!includeTerritories && !includeMilitary) { regex = "^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$"; } else if (includeTerritories && includeMilitary) { regex = "^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$"; } else if (includeTerritories) { regex = "^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$"; } else { regex = "^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$"; } regex = caseSensitive ? new RegExp(regex) : new RegExp(regex, "i"); return this.optional(element) || regex.test(value); }, "Please specify a valid state");