ewa.mahardika Posted November 14, 2020 Share Posted November 14, 2020 hei guys! Can you help me? I want to make a validation phone number. So later at the checkout, the customer must enter the 11 digit phone number, if it is less than 11 digits there will be a warning 'your phone number is less than 11'. how to make? thankyou! Link to comment Share on other sites More sharing options...
Guest Posted November 16, 2020 Share Posted November 16, 2020 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now