Jump to content

Validate phone number


ewa.mahardika

Recommended Posts

1. ./classes/validate.php

change function isPhoneNumber($number)

strlen($number) == 11 = is the number of characters

public static function isPhoneNumber($number)
    {
        return (preg_match('/^[+0-9. ()-]*$/', $number) AND strlen($number) == 11);
    }

 

2. ./js/validate.js

change function validate_isPhoneNumber(s)

s.length == 11 = is the number of characters

function validate_isPhoneNumber(s)
{
	var reg = /^[+0-9. ()-]+$/;
	return (reg.test(s) && s.length == 11);
}

 

3. clear cache and recompile template

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...