Support » Plugin: ReCaptcha v2 for Contact Form 7 » The form tag should be marked as invalid when Recaptcha is not filled

  • With the current WPCF7 form API the form tag after invalid submissions looks like below:
    <form action="/#wpcf7-f110-p186-o1" method="post" class="wpcf7-form invalid" novalidate="novalidate" data-status="invalid" _lpchecked="1">

    Unfortunately, this is not the case when we submit the form with un-checked Recaptcha.
    It’s wrong, because we cannot address styles to messages, etc.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author IQComputing



    Thank you for bringing this to our attention! We will look into adding this feature in the next version of the plugin. Once released we’ll reply here to let you know and resolve the thread. Thanks again and have a wonderful rest of your week!

    Plugin Author IQComputing



    After testing this, the reason we do not mark the form as invalid is specifically for spambots. The form instead gets marked as “spam” with both the spam class and data-status="spam". This is to ensure that 3rd party plugins such as Flamingo and Akismet pick up on this. Currently, it’s not something we feel should change.

    You could create your own custom validation following the Contact Form 7 Help Docs.

    You may also need to look at our wpcf7spam javascript event listener in:
    /wpcf7-recaptcha/assets/js/wpcf7-recaptcha-controls.js<br />
    Replicating the functionality here, removing the event listener, and adding your own for wpcf7invalid.

    Hopefully you understand why we’ve chosen not to set forms as invalid and the above instructions help you override this functionality if you so choose. We’ll mark this thread as resolved for now but should you have any other questions regarding the above feel free to reply here and we can get back to you. Stay safe and have a wonderful rest of your week!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.