matheus_nv Posted January 9, 2014 Share Posted January 9, 2014 (edited) Hi, I would like to force people to put at least 10 numbers in the phone area when they are adding the address, the reason is so they put the area code too, in my country(brazil) we call this DDD. When they put less than 10 numbers the error message is supossed to guide them, or show them why things went wrong, for example, saying they must put the area code(DDD). There's a way? I use PS 1.5.6. Thank's. Edited January 9, 2014 by matheus_nv (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted January 9, 2014 Share Posted January 9, 2014 you have to modify Validate class, there is an function public static function isPhoneNumber($number) { return preg_match('/^[+0-9. ()-]*$/', $number); } modify it to: public static function isPhoneNumber($number) { if (preg_match('/^[+0-9. ()-]*$/', $number)==true && strlen($number)==10) return true; } Link to comment Share on other sites More sharing options...
matheus_nv Posted January 9, 2014 Author Share Posted January 9, 2014 THANK'S! It worked! Link to comment Share on other sites More sharing options...
vekia Posted January 9, 2014 Share Posted January 9, 2014 you want at least 10 numbers or 10 numbers only? Link to comment Share on other sites More sharing options...
Recommended Posts