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]


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)

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