Restrict phone form field to numbers only and verify if email is valid format
Hi, how do I restrict and customise what can be entered in form fields. Could anyone help please? Thanks
- phone number: allow to only enter numbers,
- phone number: in which number format to correctly add a country code
- email:" verify that the email is valid
Best Answer
-
Hi!
I am sorry to say that we currently do not have a way to validate certain fields in our contact form.
If we take a closer look underneath the hood, we'll see that the input type for the telephone field has been set to "tel":
So why does it allow letters? According to MDN Web Docs, "
<input>
elements of typetel
are used to let the user enter and edit a telephone number. Unlike<input type="email">
and<input type="url">
, the input value is not automatically validated to a particular format before the form can be submitted, because formats for telephone numbers vary so much around the world." So, this was done by design.I encourage you to checkout Paperform to see if they offer this functionality (available from our App Store and comes with a free 14-day trial) or add this as a feature request on our Ideas Board. Please make sure to be signed in.
1
Answers
-
Hey @yas
Hoping I can help here.
- phone number: allow to only enter numbers - You can change the field type to phone number and then it will only allow numbers. See screenshot below.
- phone number: in which number format to correctly add a country code - I don't think there is an option to add a country code "option". They can add their country code if they want but I dont think there is a way to force that
- email:" verify that the email is valid - I don't think there is a feature for this either. A work around is just adding a second line and put "confirm email". This will prompt people to double check themselves
Hope this helps somewhat.
1 -
Thanks. I have set it to phone number already, but when I use the field in preview it allows me to enter letters and the form still gets sent out (although it should come up with an error saying inout numbers only)
0