phpwordpressformscontact-form-7

Contact form 7 telephone number verification


I am trying to use the built in verification method for contact form 7 to verify a telephone number.

Contact form 7 markup:

<p>[number* your-telephone min:1000000000 max:9999999999 placeholder "Telephone number"] </p>

<p>[submit "submit"]</p>

So, what I am trying to do here is restrict phone number using the min and max properties of input type of number. But the problem here is that if I enter a telephone number say: 0402356584 then it is less than the min value but is still a phone number.

So, how can I set the min and max value to support all possible 10 digit telephone numbers?

Any other solution different from my approach is also most welcome. Because I have got a feeling that the verification can not be done using min and max attributes.

I also tried to edit the plugin files via functions.php file by using the code from a source but that did not work.

So, if any one has the perfect solution to validate telephone numbers on contact form 7 then please post your answers.


Solution

  • Try this one definitely it will work as per contact form 7 documentation.

    [number* your-telephone minlength:10 maxlength:140 placeholder "Telephone number"]