This would need to be updated for international numbers, or to allow users to enter phone numbers using letter representation.
In a real case, this function would probably be called as part of a larger validate form function.
If the phone number was invalid, we would want to return false to cancel form submission as well as informing the user of the errors of their ways.
This code validates a 10 digit phone number taken in any format and sets the phone number text field to the desired output format.
Just set the Character length( Maximum and minimum) of the field, please see the attached Screenshot for reference.
The first Text Box is Name that allows only characters and spaces.
This notation requires that international phone numbers include a leading plus sign (known as the ), and allows only spaces to separate groups of digits. EPP is a relatively recent protocol (finalized in 2004), designed for communication between domain name registries and registrars.