Support » Plugin: Honeypot for Contact Form 7 » An invalid form control with name=” is not focusable

  • Resolved rockysaini

    (@rockysaini)


    Hi,

    Hi i have a HTML5 validated form , giving problem to me. how can I set the honeypot field without HTML 5 validation within a html5 validated form.

    Console Error : An invalid form control with name=” is not focusable

    Thanks

    • This topic was modified 5 years, 6 months ago by rockysaini.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter rockysaini

    (@rockysaini)

    Hey, guys, I found a solution please confirm is it a good solution,
    <script>

    jQuery(document).ready(function(jQuery){

    jQuery(“.wpcf7-form-control”).prop(‘required’,true);
    jQuery(“.wpcf7-form”).removeAttr(‘novalidate’);

    // added line below to stop html 5 validation on my honeypot field adding class manually in plugin to the field getting genrated
    jQuery(“.added_myclassname_unique.wpcf7-form-control”).prop(‘required’,false);

    });

    </script>

    • This reply was modified 5 years, 6 months ago by rockysaini.
    Plugin Author Ryan

    (@daobydesign)

    Hi @rockysaini, apologies for only now just seeing this. Not sure how I missed it.

    I believe the problem is that your jQuery is casting too wide a net, setting all fields to “required”.

    Specifically, this:
    jQuery(“.wpcf7-form-control”).prop(‘required’,true);

    That will set all fields to “required”. You could simply be more specific in their selection there. However, if you have a lot of fields and that’s a hassle, then yes, overriding that with your Honeypot field and setting it back to false would work. You could also utilize jQuery’s .not() function in the initial jQuery, rather than add an additional line. But either way will work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘An invalid form control with name=” is not focusable’ is closed to new replies.