Phone Number Input Validation [redux]

step 1 - add pattern

Add this custom attribute to phone feild
image

  • name: pattern
  • value: [1]*$

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.

https://martinwolf.org/before-2018/blog/2015/04/html5-telephone-input-validation/

Step 2 - Change type to tel

image

summary (old screenshot **old UI)

related


  1. 0-9-+s() ↩︎

5 Likes