-
-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Phone Number field doesn't validate correctly if Country option is disabled #2273
Comments
We've been intentional about validation for the Phone Number field, as phone numbers can be notoriously tricky to validate. In particular, out of the previous form libraries we used before Formie came along, this was a massive pain. When the Country option is enabled, we use client-side validation, that requires a country to be selected. This is the intl-tel-input library. This cannot work without a country option, and cannot be used to validate just plain numbers without the context of a country - rightly so. I don't want to go down the road of implementing our own client-side logic when not picking a country. While alphabetic characters would seemingly be invalid, they're not always. We need to handle special characters like Which leaves us to possibly looking to implement the libphonenumber library (that Open to other suggestions of course. |
I understand the situation. Adding the possibility of manually setting a regex for validation would also be great. Or would that be possible by setting a |
I did consider Regex, but in Formie's mission to be a client-friendly as possible, it seemed a bit "advanced". But yes, in the Input Attributes you can add |
Maybe you have an idea for this. Ofcourse we know how to add a |
Describe the bug
When the Country option is enabled and you enter only alphabetic characters the validation returns
Invalid number
.When the Country option is disabled and you enter only alphabetic characters the validation is valid for some reason.
Steps to reproduce
Form settings
Craft CMS version
5.6.1
Plugin version
3.0.19
Multi-site?
No
Additional context
No response
The text was updated successfully, but these errors were encountered: