Q
Q
qvvi2016-12-30 16:01:48
Design patterns
qvvi, 2016-12-30 16:01:48

Pattern for phone input form?

Hello.
There is a form:

<input maxlength="30" type="text" placeholder="+7 (123) 456-78-90" name="phone" eform="Телефон::1" class="form-control" id="exampleInputEmail1" />

How can I add a pattern to it so that only numbers, spaces and +)(- symbols can be entered
without rigid reference to the number of characters, their location and order?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Yarkov, 2016-12-30
@qvvi

pattern="\+?[0-9\s\-\(\)]+"

X
xmoonlight, 2016-12-30
@xmoonlight

https://codepen.io/vitaly-zdanevich/pen/VLVXaL

Y
Yevgeniy Kisselyov, 2017-06-06
@Pavlusha

There are 4 opening brackets, 5 closing brackets.
On the next line, the same thing.
Remove one closing parenthesis on these lines.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question