• Resolved scriptic

    (@scriptic)


    After a user submits a form on the website, I want to be able to keep track of all submitted forms through a pdf copy of each completed form. I want to do this by creating a datatable on the website that keeps track of the form submissions, including some the fields that were filled out and a downloadable pdf link to be able to view the form as a whole. The purpose is that the user should be able to go back and easily access submitted form copies on the website from the table.

    I’m currently using e2pdf plugin to create the pdfs based on form submission and the pdfs are being stored in a File Manager. I’m also using the wpDataTables plugin to connect with Forminator and grab the necessary fields to display in the datatable. However, I’m unsure how to create my end goal of having the final form submission pdf link to display on the table, so the user can download the submission.

    Do you have any suggestions on how to go about this? Would the pdf feature of Forminator Pro be able to create this?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @scriptic

    I hope you are doing well today.

    With Fominator PDF Pro add-on you will be able to see PDFs in your submissions page, in admin email and in email which will be send to person who will fill the form. However there is no feature to display PDF file on front side and show it to logged in user. Hope PDF in email to user can cover your request. Again, note this is a Pro feature.

    Kind Regards,
    Kris

    Thread Starter scriptic

    (@scriptic)

    Unfortunately, emailing the user won’t cover my request

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @scriptic

    I hope you are doing well.

    In that case, it would require some custom coding, for example bringing all the files you have in the PDF directory, from the Forminator we do have a hook you could use to save the PDF link.

    For example:

    – Create a hidden field,
    – Use PHP to get the PDF URL after form submission and then save it in the hidden field, once done you can just use the hidden field in your table.

    This would be a start code, but you need to figure out with the 2PDF support how to grab the PDF URL.

    <?php
    
    add_filter('forminator_prepared_data', 'wpmudev_update_hidden_field_val_twin', 10, 2);
    function wpmudev_update_hidden_field_val_twin($prepared_data, $module_object)
    {
    
        $form_ids = array(6); // Please change the form ID.
    
        if (!in_array($module_object->id, $form_ids)) {
            return $prepared_data;
        }
    
        // get the PDF URL, you can ask e2PDF for the correct code
        $file_url = '';
    
        if (empty($prepared_data['hidden-1'])) {
            $prepared_data['hidden-1'] = $file_url;
        }
    
        return $prepared_data;
    }
    
    add_action('forminator_custom_form_submit_before_set_fields', 'wpmudev_change_hidden_field_data_twin', 10, 3);
    function wpmudev_change_hidden_field_data_twin($entry, $module_id, $field_data_array)
    {
        $form_ids = array(6); // Please change the form ID.
        if (!in_array($module_id, $form_ids)) {
            return;
        }
    
        // get the PDF URL, you can ask e2PDF for the correct code
        $file_url = '';
    
        foreach ($field_data_array as $key => $value) {
            if (strpos($value['name'], 'hidden-1') !== false) {
                Forminator_CForm_Front_Action::$info['field_data_array'][$key]['value'] =  $file_url;
            }
        }
    }

    Best Regards
    Patrik Freitas

    Thread Starter scriptic

    (@scriptic)

    Sounds good, thank you for the help. I believe wpDataTables is having issues grabbing data from Forminator Forms currently. Once their support gets back to me I will implement this code.

    If I wanted to use Forminator Pro PDF option instead of the E2PDF plugin, how would the provided code change?

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @scriptic

    I hope you are doing well.

    If I wanted to use Forminator Pro PDF option instead of the E2PDF plugin, how would the provided code change?

    Per forum rules we can only provide support for Free version, in case you get the Pro version kindly open a ticket on https://wpmudev.com/hub2/support

    Best Regards
    Patrick Freitas

    Thread Starter scriptic

    (@scriptic)

    Sure, no problem. I have a question regarding this line of code:

    $form_ids = array(6); // Please change the form ID

    Could you elaborate on what you mean by the commented code to change the form ID?

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @scriptic

    Please edit your form and check admin url, which will be:

    domain.com/wp-admin/admin.php?page=forminator-cform-wizard&id=123

    where 123 will be your form ID. Hope this helps.

    Kind Regards,
    Kris

    Thread Starter scriptic

    (@scriptic)

    Hi,

    I have a few questions about potentially rewriting the custom code. I used an e2pdf shortcode to save the form submission. These PDF files save to a specific folder path in my WP File Manager. The saved files have a filename that matches the appropriate submission ID of each form.

    Is there any way to incorporate the save or download e2pdf shortcode into the php custom code, or to grab the file based on submission ID from the WP File Manager?

    Also, when adding the custom code to a hidden field, should the default value be “custom value” or “query parameter”?

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @scriptic

    I pinged our SLS Team to review your queries and see what will be possible in this case. We will post an update here as soon as more information is available.

    Kind Regards,
    Kris

    Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hello @scriptic,

    [e2pdf-download id="..."] shortcode seems to be working fine with wpDataTables, when I put it directly as a custom value in the hidden field:

    https://prnt.sc/EiruaWvBAJb1

    It then can be referenced in wpDataTables. Please note, that you will also need to install and activate wpDataTables integration for Forminator Forms plugin, in order to be able to select Forminator source:
    https://prnt.sc/Ud4aWbbmtw_6

    Please check it on your end, and let us know if that works for you.

    Best Regards,
    Dmytro

    Thread Starter scriptic

    (@scriptic)

    This resolved my issue, thank you

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘PDF of submissions in table’ is closed to new replies.