Jump to content

[SOLVED]Minimum 10 numbers in Phone!


Recommended Posts

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 by matheus_nv (see edit history)
Link to comment
Share on other sites

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

×
×
  • Create New...