Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to validate a phone number and make sure the user enters all 10 digits. This can be done using the HTML5 pattern atribute:

<input pattern=".{10,}" title="10 characters minimum">

How can I add this pattern attribute to my input tag in Contact Form 7 ?

This what the mobile number input shortcode looks like:

[text* mobile id:field-mobile]

share|improve this question

closed as off-topic by birgire, Pieter Goosen, toscho Jul 26 at 9:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 1 down vote accepted

You can use a tel shortcode to do this:

[tel* id:field-mobile 10/10 "placeholder text"]

This brings up the issue of browser support; if the browser in use does not support the tel input type, it will fall back to a plain text field.

Source: http://contactform7.com/text-fields/ (halfway down the page)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.