Search code examples
wordpressvalidationplaceholdercontact-form-7

Mandatory field validation not working on text input field with placeholder in WordPress Contact Form 7


I was adding a text field in my form which has a placeholder also it is set as required, but on submit it is not validated for empty field

bellow is the code for that text field

<td width="38%" class="f_name1" >
  [text* firstname placeholder class:text_field "First Name" ]
</td>

when I am removing the placeholder option them validation is working correctly but with placeholder option it not validating...

Am I following the wrong path to add placeholder? Any one with any suggestion will help me a lot..


Solution

  • You probably should change the order so the placeholder text is right next to placeholder.

      [text* firstname class:text_field placeholder "First Name"]
    

    as mentioned in the doc: http://contactform7.com/setting-placeholder-text/ and you need Contact Form 7 3.4 and higher.