Streaming live at 10am (PST)

Phone Number Input Validation [redux]

Continuing the discussion from Phone Number Input Validation:

Has anybody found out how to force numeric input in Webflow form input fields? Thanks.

1 Like

step 1 - add pattern

Add this custom attribute to phone feild

  • name: pattern
  • value: ^[0-9-+s()]*$

The code behind scene:
<input type="tel" pattern="^[0-9-+s()]*$" placeholder="Telephone Number" required>

numbers (0-9), the minus symbol (-), the plus symbol (+) as well as spaces (s) and parentheses (()) are allowed.


Step 2 - Change type to tel


summary (old screenshot **old UI)




Thank you very much for this, Ezra!

1 Like

Mark as solution. Thanks

Hi Ezra. I used the attached settings since in my case the phone field is optional and Iā€™m after 11-digit UK phone numbers without any symbols. It probably could be done more neatly but seems to work ok. Thanks.

in the pattern value you can change it by regex. It is an easy and more powerful method. here is the code : ^([+])?([^\\d]?\\d){5,18}$
But i quit using regex because it has his limitations (It allows only 5 to 18 digits with up to 1 character between digits) and started using Veriphone