How to trigger validation of the required fields from another button without submitting the form in Contact Form 7

Our website is using Contact Form 7 plugin for our long forms. I just added a feature to be able to download a PDF version of the long forms, with the user’s manually entered fields, with a click of a button. Let’s call it the “Export” button. Then they can choose to email that PDF to us whenever they are ready.

But what’s needed from these forms are that they some be completely filled. In normal use, a user submits the form successfully when the required fields are complete and valid. On the other hand, the “Export” button when pressed should check the required fields first (with ajax validation) before exporting the PDF download.

Right now, the “Export” button just downloads the PDF form even with the form fields empty. This is achieved using jsPDF. How can this “Export” button validate the required fields first before generating the PDF version of the form, without submitting the form, using CF7’s validation error messages? Thanks in advance

Read more here:: How to trigger validation of the required fields from another button without submitting the form in Contact Form 7

Leave a Reply

Your email address will not be published. Required fields are marked *