Browse Source

Merge branch 'pk-mobile-validate' of https://github.com/abuzer/bootstrapvalidator into abuzer-pk-mobile-validate

Conflicts:
	src/js/validator/phone.js
Phuoc Nguyen 11 years ago
parent
commit
a16d38ae8d
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/js/validator/phone.js

+ 8 - 1
src/js/validator/phone.js

@@ -9,6 +9,7 @@
             FR: 'France',
             GB: 'United Kingdom',
             MA: 'Morocco',
+            PK: 'Pakistan',
             US: 'USA'
         }
     });
@@ -20,7 +21,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
@@ -91,6 +92,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: