Browse Source

#621: Add Pakistan phone number validator, thanks to @abuzer

Phuoc Nguyen 11 years ago
parent
commit
8fc43eda67

+ 1 - 0
CHANGELOG.md

@@ -9,6 +9,7 @@ __New features__
 * [#510](https://github.com/nghuuphuoc/bootstrapvalidator/pull/510): Add French [phone number](http://bootstrapvalidator.com/validators/phone/) validator, thanks to [@dlucazeau](https://github.com/dlucazeau)
 * [#536](https://github.com/nghuuphuoc/bootstrapvalidator/pull/536): Add Spanish [phone number](http://bootstrapvalidator.com/validators/phone/) validator, thanks to [@vadail](https://github.com/vadail)
 * [#519](https://github.com/nghuuphuoc/bootstrapvalidator/pull/519): Add Iceland [VAT](http://bootstrapvalidator.com/validators/vat/) number validator, thanks to [@evilchili](https://github.com/evilchili)
+* [#621](https://github.com/nghuuphuoc/bootstrapvalidator/pull/621): Add Pakistan [phone number](http://bootstrapvalidator.com/validators/phone/) validator, thanks to [@abuzer](https://github.com/abuzer)
 * [#637](https://github.com/nghuuphuoc/bootstrapvalidator/pull/637): Add South African [VAT](http://bootstrapvalidator.com/validators/vat/) number validator, thanks to [@evilchili](https://github.com/evilchili)
 * [#638](https://github.com/nghuuphuoc/bootstrapvalidator/pull/638): Add Brazilian [phone number](http://bootstrapvalidator.com/validators/phone/) and [postal code](http://bootstrapvalidator.com/validators/zipCode/) validator, thanks to [@fhferreira](https://github.com/fhferreira)
 * [#643](https://github.com/nghuuphuoc/bootstrapvalidator/pull/643): Add [zipCode](http://bootstrapvalidator.com/validators/zipCode/), [iban](http://bootstrapvalidator.com/validators/iban/) and [phone number](http://bootstrapvalidator.com/validators/phone/) validators for Morocco, thanks to [@Arkni](https://github.com/Arkni)

+ 1 - 0
CONTRIBUTORS.md

@@ -2,6 +2,7 @@
 
 I would like to give big thanks to the following contributors:
 
+* [@abuzer](https://github.com/abuzer)
 * [@aca02djr](https://github.com/aca02djr)
 * [@adgrafik](https://github.com/adgrafik)
 * [@AdwinTrave](https://github.com/AdwinTrave)

+ 1 - 1
dist/css/bootstrapValidator.min.css

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.1-dev, built on 2014-08-09 8:30:11 AM
+ * @version     v0.5.1-dev, built on 2014-08-09 9:16:02 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT

+ 9 - 2
dist/js/bootstrapValidator.js

@@ -2,7 +2,7 @@
  * BootstrapValidator (http://bootstrapvalidator.com)
  * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
  *
- * @version     v0.5.1-dev, built on 2014-08-09 8:30:11 AM
+ * @version     v0.5.1-dev, built on 2014-08-09 9:16:02 AM
  * @author      https://twitter.com/nghuuphuoc
  * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
  * @license     MIT
@@ -4532,6 +4532,7 @@
             FR: 'France',
             GB: 'United Kingdom',
             MA: 'Morocco',
+            PK: 'Pakistan',
             US: 'USA'
         }
     });
@@ -4543,7 +4544,7 @@
         },
 
         // The supported countries
-        COUNTRY_CODES: ['BR', 'ES', 'FR', 'GB', 'MA', 'US'],
+        COUNTRY_CODES: ['BR', 'ES', 'FR', 'GB', 'MA', 'PK', 'US'],
 
         /**
          * Return true if the input value contains a valid phone number for the country
@@ -4614,6 +4615,12 @@
                     isValid = (/^(?:(?:(?:\+|00)212[\s]?(?:[\s]?\(0\)[\s]?)?)|0){1}(?:5[\s.-]?[2-3]|6[\s.-]?[13-9]){1}[0-9]{1}(?:[\s.-]?\d{2}){3}$/).test(value);
                     break;
                 
+                case 'PK':
+                    // http://regex101.com/r/yH8aV9/2
+                    value   = $.trim(value);
+                    isValid = (/^0?3[0-9]{2}[0-9]{7}$/).test(value);
+                    break;
+                
                 case 'US':
                 /* falls through */
                 default:

File diff suppressed because it is too large
+ 3 - 3
dist/js/bootstrapValidator.min.js


+ 1 - 0
dist/js/language/be_NL.js

@@ -234,6 +234,7 @@
                 FR: 'Frankrijk',
                 GB: 'Verenigd Koninkrijk',
                 MA: 'Marokko',
+                PK: 'Pakistan',
                 US: 'VS'
             }
         },

+ 1 - 0
dist/js/language/bg_BG.js

@@ -234,6 +234,7 @@
                 FR: 'Франция',
                 GB: 'Великобритания',
                 MA: 'Мароко',
+                PK: 'Пакистан',
                 US: 'САЩ'
             }
         },

+ 1 - 0
dist/js/language/cs_CZ.js

@@ -234,6 +234,7 @@
                 FR: 'Francii',
                 GB: 'Velkou Británii',
                 MA: 'Maroko',
+                PK: 'Pákistán',
                 US: 'Spojené Státy Americké'
             }
         },

+ 1 - 0
dist/js/language/da_DK.js

@@ -234,6 +234,7 @@
                 FR: 'Frankrig',
                 GB: 'England',
                 MA: 'Marokko',
+                PK: 'Pakistan',
                 US: 'USA'
             }
         },

+ 1 - 0
dist/js/language/de_DE.js

@@ -234,6 +234,7 @@
                 FR: 'Frankreich',
                 GB: 'Vereinigtes Königreich',
                 MA: 'Marokko',
+                PK: 'Pakistan',
                 US: 'Vereinigte Staaten'
             }
         },

+ 1 - 0
dist/js/language/en_US.js

@@ -234,6 +234,7 @@
                 FR: 'France',
                 GB: 'United Kingdom',
                 MA: 'Morocco',
+                PK: 'Pakistan',
                 US: 'USA'
             }
         },

+ 1 - 0
dist/js/language/es_CL.js

@@ -234,6 +234,7 @@
                 FR: 'Francia',
                 GB: 'Reino Unido',
                 MA: 'Marruecos',
+                PK: 'Pakistán',
                 US: 'EE.UU.'
             }
         },

+ 1 - 0
dist/js/language/es_ES.js

@@ -234,6 +234,7 @@
                 FR: 'Francia',
                 GB: 'Reino Unido',
                 MA: 'Marruecos',
+                PK: 'Pakistán',
                 US: 'EE.UU.'
             }
         },

+ 1 - 0
dist/js/language/fr_FR.js

@@ -234,6 +234,7 @@
                 FR: 'la France',
                 GB: 'le Royaume Uni',
                 MA: 'Maroc',
+                PK: 'le Pakistan',
                 US: 'les USA'
             }
         },

+ 1 - 0
dist/js/language/gr_EL.js

@@ -234,6 +234,7 @@
                 FR: 'Γαλλία',
                 GB: 'Ηνωμένο Βασίλειο',
                 MA: 'Μαρόκο',
+                PK: 'Πακιστάν',
                 US: 'ΗΠΑ'
             }
         },

+ 1 - 0
dist/js/language/hu_HU.js

@@ -234,6 +234,7 @@
                 FR: 'francia',
                 GB: 'Egyesült Királyság beli',
                 MA: 'Marokkó',
+                PK: 'Pakisztán',
                 US: 'Egyesült Államok beli'
             }
         },

+ 1 - 0
dist/js/language/it_IT.js

@@ -234,6 +234,7 @@
                 FR: 'Francia',
                 GB: 'Regno Unito',
                 MA: 'Marocco',
+                PK: 'Pakistan',
                 US: 'Stati Uniti d\'America'
             }
         },

+ 1 - 0
dist/js/language/pl_PL.js

@@ -234,6 +234,7 @@
                 FR: 'Francja',
                 GB: 'Wielka Brytania',
                 MA: 'Maroko',
+                PK: 'Pakistan',
                 US: 'USA'
             }
         },

+ 1 - 0
dist/js/language/pt_BR.js

@@ -234,6 +234,7 @@
                 FR: 'França',
                 GB: 'Reino Unido',
                 MA: 'Marrocos',
+                PK: 'Paquistão',
                 US: 'Estados Unidos'
             }
         },

+ 1 - 0
dist/js/language/tr_TR.js

@@ -234,6 +234,7 @@
                 FR: 'Fransa',
                 GB: 'İngiltere',
                 MA: 'Fas',
+                PK: 'Pakistan',
                 US: 'Amerika'
             }
         },

+ 1 - 0
dist/js/language/vi_VN.js

@@ -234,6 +234,7 @@
                 FR: 'Pháp',
                 GB: 'Vương quốc Anh',
                 MA: 'Maroc',
+                PK: 'Pakistan',
                 US: 'Mỹ'
             }
         },

+ 1 - 0
dist/js/language/zh_CN.js

@@ -234,6 +234,7 @@
                 FR: '法国',
                 GB: '英国',
                 MA: '摩洛哥',
+                PK: '巴基斯坦',
                 US: '美国'
             }
         },

+ 1 - 0
dist/js/language/zh_TW.js

@@ -234,6 +234,7 @@
                 FR: '法國',
                 GB: '英國',
                 MA: '摩洛哥',
+                PK: '巴基斯坦',
                 US: '美國'
             }
         },

+ 1 - 0
src/js/language/be_NL.js

@@ -234,6 +234,7 @@
                 FR: 'Frankrijk',
                 GB: 'Verenigd Koninkrijk',
                 MA: 'Marokko',
+                PK: 'Pakistan',
                 US: 'VS'
             }
         },

+ 1 - 0
src/js/language/bg_BG.js

@@ -234,6 +234,7 @@
                 FR: 'Франция',
                 GB: 'Великобритания',
                 MA: 'Мароко',
+                PK: 'Пакистан',
                 US: 'САЩ'
             }
         },

+ 1 - 0
src/js/language/cs_CZ.js

@@ -234,6 +234,7 @@
                 FR: 'Francii',
                 GB: 'Velkou Británii',
                 MA: 'Maroko',
+                PK: 'Pákistán',
                 US: 'Spojené Státy Americké'
             }
         },

+ 1 - 0
src/js/language/da_DK.js

@@ -234,6 +234,7 @@
                 FR: 'Frankrig',
                 GB: 'England',
                 MA: 'Marokko',
+                PK: 'Pakistan',
                 US: 'USA'
             }
         },

+ 1 - 0
src/js/language/de_DE.js

@@ -234,6 +234,7 @@
                 FR: 'Frankreich',
                 GB: 'Vereinigtes Königreich',
                 MA: 'Marokko',
+                PK: 'Pakistan',
                 US: 'Vereinigte Staaten'
             }
         },

+ 1 - 0
src/js/language/en_US.js

@@ -234,6 +234,7 @@
                 FR: 'France',
                 GB: 'United Kingdom',
                 MA: 'Morocco',
+                PK: 'Pakistan',
                 US: 'USA'
             }
         },

+ 1 - 0
src/js/language/es_CL.js

@@ -234,6 +234,7 @@
                 FR: 'Francia',
                 GB: 'Reino Unido',
                 MA: 'Marruecos',
+                PK: 'Pakistán',
                 US: 'EE.UU.'
             }
         },

+ 1 - 0
src/js/language/es_ES.js

@@ -234,6 +234,7 @@
                 FR: 'Francia',
                 GB: 'Reino Unido',
                 MA: 'Marruecos',
+                PK: 'Pakistán',
                 US: 'EE.UU.'
             }
         },

+ 1 - 0
src/js/language/fr_FR.js

@@ -234,6 +234,7 @@
                 FR: 'la France',
                 GB: 'le Royaume Uni',
                 MA: 'Maroc',
+                PK: 'le Pakistan',
                 US: 'les USA'
             }
         },

+ 1 - 0
src/js/language/gr_EL.js

@@ -234,6 +234,7 @@
                 FR: 'Γαλλία',
                 GB: 'Ηνωμένο Βασίλειο',
                 MA: 'Μαρόκο',
+                PK: 'Πακιστάν',
                 US: 'ΗΠΑ'
             }
         },

+ 1 - 0
src/js/language/hu_HU.js

@@ -234,6 +234,7 @@
                 FR: 'francia',
                 GB: 'Egyesült Királyság beli',
                 MA: 'Marokkó',
+                PK: 'Pakisztán',
                 US: 'Egyesült Államok beli'
             }
         },

+ 1 - 0
src/js/language/it_IT.js

@@ -234,6 +234,7 @@
                 FR: 'Francia',
                 GB: 'Regno Unito',
                 MA: 'Marocco',
+                PK: 'Pakistan',
                 US: 'Stati Uniti d\'America'
             }
         },

+ 1 - 0
src/js/language/pl_PL.js

@@ -234,6 +234,7 @@
                 FR: 'Francja',
                 GB: 'Wielka Brytania',
                 MA: 'Maroko',
+                PK: 'Pakistan',
                 US: 'USA'
             }
         },

+ 1 - 0
src/js/language/pt_BR.js

@@ -234,6 +234,7 @@
                 FR: 'França',
                 GB: 'Reino Unido',
                 MA: 'Marrocos',
+                PK: 'Paquistão',
                 US: 'Estados Unidos'
             }
         },

+ 1 - 0
src/js/language/tr_TR.js

@@ -234,6 +234,7 @@
                 FR: 'Fransa',
                 GB: 'İngiltere',
                 MA: 'Fas',
+                PK: 'Pakistan',
                 US: 'Amerika'
             }
         },

+ 1 - 0
src/js/language/vi_VN.js

@@ -234,6 +234,7 @@
                 FR: 'Pháp',
                 GB: 'Vương quốc Anh',
                 MA: 'Maroc',
+                PK: 'Pakistan',
                 US: 'Mỹ'
             }
         },

+ 1 - 0
src/js/language/zh_CN.js

@@ -234,6 +234,7 @@
                 FR: '法国',
                 GB: '英国',
                 MA: '摩洛哥',
+                PK: '巴基斯坦',
                 US: '美国'
             }
         },

+ 1 - 0
src/js/language/zh_TW.js

@@ -234,6 +234,7 @@
                 FR: '法國',
                 GB: '英國',
                 MA: '摩洛哥',
+                PK: '巴基斯坦',
                 US: '美國'
             }
         },