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.