How to validate International phone number to disallow letters

Hi, my form needs to allow for users anywhere in the world to input their phone number, therefore, I cannot use the North American format which includes a numbers-only validation. Why does the International format allow letters? How can we disable letters and allow numbers and symbols only? I’ve read the closed threads on this topic and a masked text input solution does not work for this purpose because we don’t know how many digits international users will require.

Thanks

The International phone format is … not great. The product team has an open issue to improve the handling of phone formats.

If you are trying to prevent the user from entering a letter in an international phone field, I don’t have a good solution for you. Gravity Forms does not handle front-end validation (as the user inputs), but that is also on our list of requested features.

You can use the gform_field_validation filter to review what the user submitted to you, and return a validation error if they used a character you do not want to allow.

Here is the documentation for gform_user_validation:

If you need assistance with the actual regex for the validation, let us know what symbols you want to allow, in addition to allowing digits. Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.