I’m currently working on a few projects, this question is brought up all the time. How can I have a visitor of a site fill out an HTML form and when they hit submit they have a pdf form they can save or print with the data they entered? The form would also send the information to an email or the database. Does eForm do this? Or does anyone know code or a program that would send me to the right direction?
i guess i could propose a page that isn’t a pdf. would that be done in eForm or another code?
thanks for the links too.
-
☆ A M B ☆
- 24,524 Posts
You can have eForm generate a page on submission that can use any chunk Tpl you specify with placeholders for what they entered in the form. Have a good print.css file for the document, and when they print it out it will be nicely formatted.
I've found a solution which is not perfect but worked good for me - I'm not a coder and you may call it a "desperate tired designer way".
I've used mPDF, which I found so much more friendly than FPDF or TCPDF, it's so easy to customize and the documentation/support is great.
The result:
One can create a pdf on any stage of filling the form without a need to fill required fields nor sending it.
There are two submit buttons: "Send" and "Create PDF". To make it work, I needed to put two forms on the page, of which one is hidden - apart from the submit button. When someone puts some input to the visible form, the content gets copied real-time into the hidden form (jQuery).
This way both forms have identical input and each of them can perform different action. Plus, the one that needs to be sent has some "required" fields and the other has all fields optional.
The mPDF gets form data via $_POST and a template from a specified chunk.
If anyone is interested, I can paste the code.
Maybe some developers here in MODx community could reuse this idea and make something nice out of it - how about the official MODx eForm to PDF / html to PDF extra?
muriz.com
-
☆ A M B ☆
- 24,524 Posts
I'd certainly like to see this.