WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 '14 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.

up vote 2 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.