Tips and cases of use for a successful WordPress website with calculated forms.
Integrating the form with the FormStack documents service (formerly WebMerge) to generate PDF files at runtime with the information collected by the forms. The post describes a case of use: the generation of purchase invoices.
The Calculated Fields Form plugin it is not able to generate PDF files at runtime by itself (The Platinum version of the plugin includes an experimental add-on to generate PDF files locally: CFF - PDF Generator add-on), however, the Platinum version of the plugin is distributed with the WebMerge add-on to supply this functionality.
The WebMerge add-on allows the integration between the form with the FormStack documents service (formerly WebMerge). FormStack documents service (formerly WebMerge) can create PDFs and other printable documents (like Word, PowerPoint, etc.) on the fly with data submitted by the form to create printable event tickets, online applications, invoices, and much more.
I'll describe the process with a case of use: Create a form for selling a product, and generate an invoice on the fly to be sent the buyer.
The first step in the process would be design the document template in FormStack documents service (formerly WebMerge):
Login in FormStack documents service (formerly WebMerge) and click on the button: "New Document":
Enter the name of new document template:
Choose the document type. In this case I'll select the "Build Your Own" option to have the total control over the template's structure:
Create the template's structure as you need. FormStack includes a WYSWG editor that facilitates the editing process. In FormStack the texts with the format: {$varname} represent the fields that would be replaced by the final texts when the PDF file is generated:
As you can see, the previous template includes the fields:
firstname lastname address email date number item_description quantity and price
Select the file to generate from the settings tab, in my case the PDF option:
The next step shows all available variables and allows you generate PDF files for testing the template. I simply will press the "Skip to Next Step" button:
Configure the delivery option. I'll send the generated files to an email address received as a FormStack field, in this case, to the value received in the "email" field:
The last step displays the "Merge URL", copy this URL because would be used to integrate the form with the FormStack documents service (formerly WebMerge):
After create the document on FormStact is time to implement the form in the website, and integrate the form with FormStack documents:
Go to the settings page of the plugin through the menu option: "Settings > Calculated Fields Form", tick the "CFF - WebMerge" checkbox and press the "Activate/Deactivate Addons" button:
Implements the form as usual, inserting the fields that would be sent to FormStack documents to generate the PDF file:
Scroll down in the form settings until the WebMerge section, and press the "Add New Document" button. Paste the URL copied previously from FormStack documents, into the attribute: "Document URL". Press the "Add Field" button as many times as FormStack's fields need to be integrated with the fields in the form.
The FormStack fields are entered at left, and the corresponding form's fields at right. There are some fields that are integrated to other constants that are not fields in the form: itemnumber corresponds to the submission's id, submissiondate_mmddyyyy corresponds to a date/time text with the submission's date. If the value entered is not a field's name, or any of previous constants, it will be considered a plain text, like Appointment Hour Booking:
Insert the form in the public website for testing:
The generated PDF file with the fields replaced by the corresponding values submitted from the form:
That's all, I've created a document template in FormStack, implemented a form in the website, and integrated both. Finally, I've tested the form and generated the PDF file.