Formidable generate pdf from DRAFT

Formidable Forms
21 November, 2021 18:25:14
Polinet
Topics: 2
Messages: 6
Hi,
I have a requirement to generate a pdf from a formidable form draft - it is for a legal agreement so the user should be able to generate the prefilled pdf without signing to show their solicitor and upon approval return and sign the form. I know a very long workaround would be to fill a "pre signing" form without signing > generate the pdf of that and then when ready to sign prefill another form with fields from the first form plus signature field and sign that but I have a VERY long list of fields and checkboxes so it is not really a good solution.
If currently the system does not support generating pdf from a form draft, but all of the form data is there aside from the status draft or not draft so maybe you can let me know where in your code the system checks for the complete entry and I can update the code to include draft entries in that query and thus enable generation of the pdf from a draft?
If you have some other suggestions on how I can accomplish the above let me know.
Thank you for an otherwise really awesome and well made plugin that has enabled me to pitch and now develop a complex business application for my client.
22 November, 2021 02:37:12
E2Pdf
Support
Topics: 7
Messages: 3163
Hi, thank you.

It's more question to Formidable Forms and not E2Pdf as you need to manipulate entries output and editing which must be done with Formidable Forms directly, however:

For E2Pdf it doesn't matter the status of entry, it's just important the entry must be created, exist and must have correct entry id which can be retrieved by E2Pdf so E2Pdf can generate PDF from its data. If you will use "draft" entry Formidable Forms functionality - you still can use [e2pdf-download id="1"] shortcode inside "Saved Draft" message, however here will be some problems as: Formidable Forms can't show/hide fields depending on draft entry status out of the box + message which can contain PDF download link will not be showed on page refresh.

As a solution you can try to build such behavior:

  • Create "Signature" field with class which will hide "Signature" (for example: frm_hidden in CSS Layout Classes) in main form.

  • Allow "Front-end" editing

  • Setup "Redirect URL" to "review-sign" page after submission to: https://example.com/review-sign/?pass_entry=[key] (Screenshot 1)

  • Setup "Redirect URL" to "review-sign" page after editing entry to: https://example.com/review-sign/?pass_entry=[key] (Screenshot 2)
    • "review-sign" page must contain Formidable Forms View Shortcode and this View must be filtered by Entry Key as: [get param="pass_entry" default="none"] (Screenshot 3)

  • The source of Formidable Form View must be something like this: https://codeshare.io/78gkzn, it will remove hidden style for signature, will show PDF or PDF download link and will show edit in place button just for signature field (1447 Field ID), if "signature" was not submitted previously.


The process with this solution will look like this: User submits Entry -> User redirected to page with "View" where will be "Sign" button -> User click "Sign" button to show "Signature" field -> "Sign" and click "Update" -> Entry will be updated and user will be redirected to same page with updated PDF.

Another possible solution if your users do not have registration process and you will not be able to setup Front-end edit. You will need to have 2 forms and the process will look like this:

  • Create "Signature" field with class which will hide "Signature" (for example: frm_hidden in CSS Layout Classes) in main form.

  • Setup "Redirect URL" to "review-sign" page after submission to: https://example.com/review-sign/?pass_entry=[key] (Screenshot 1

  • Here will be the difference in setting up the "View". You will need to have another "Form" which will contain "Signature" Field + "Hidden" text field with default value set as [get param="pass_entry"] to have connection to main entry. 2nd form shortcode must be placed inside "View". 2nd form also must have "Redirect URL" as https://example.com/review-sign/?pass_entry=[30] where [30] is the "hidden" field id with [get param="pass_entry"] as default value.

  • Setup PHP hook in your functions.php. It's required to detect 2nd form submission and update main entry "signature" with current PHP hook: https://codeshare.io/r9LzRZ. You will need to update Field IDs to yours in the code.


So the process with such solution will be like this: User Submits Main Form -> User redirects to page with "View" where will be shortcodes from E2Pdf and 2nd Form with "Signature" -> User "Sign" "Signature" in the 2nd form and "Submit" it -> The hook will copy submitted signature from 2nd form to the main entry by detecting main entry with "hidden" field ID.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
22 November, 2021 03:18:29
Polinet
Topics: 2
Messages: 6
I must say I have been building websites for 18 years and you guys go above and beyond in your willingness to help and detailed explanations! Bravo!

I will try your suggested solutions tomorrow.

I did try adding download pdf shortcode to the view that displays draft entries but it produced no link or output which is why I came here to ask if draft to pdf was supported. But I like your first solution and will give it a go.
22 November, 2021 03:31:27
E2Pdf
Support
Topics: 7
Messages: 3163
Thank you.

As about "draft" entries View - be sure that you used shortcode as [e2pdf-download id="1" dataset="[id]"] inside, as dataset="[id]" is required to be defined inside Formidable Forms Views.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
22 November, 2021 04:04:38
Polinet
Topics: 2
Messages: 6
I did use that shortcode as I have the view that displays both draft and completed entries - same view and filter set to display draft and completed. The shortocde next to completed entry correctly generated Download link and next to draft entry (same view, same code!) generated a blank.
But I will double-check everything again if you think it should have worked.