PDF Link Generation and pass it to another form through post data

  • RogerYelvington01
    Asked on March 3, 2017 at 4:51 PM

    Hi Guys!

    1.  I would like to be able to generate a PDF Link of the form upon submission

    2.  Instead of sending the link to the email notification, I would like to use post data

    3.  I would like to have a custom Thank You url form link, that gets filled with the PDF link from the previous form.

     

    IE:

    >Post the link generated from this form:   https://form.jotform.com/51105570784959

    >To the Custom Thank you URL, and into the Hidden Text Field Labeled "PDF Link" in this form: https://form.jotform.com/70616540635959

     

    Please advise, thank you!

     

    Roger

  • Elton Support Team Lead
    Replied on March 4, 2017 at 2:24 AM

    That's possible with JotForm through post data.

    First, you need to enable post data in your form

    http://www.jotform.com/help/51-How-to-Post-Submission-Data-to-Thank-You-Page

    Then write a custom PHP script that captures the PDF link and then loads it to another form.

    After that, you must set the PHP page as the thank you URL of this form https://form.jotform.com/51105570784959.

    Alternatively, you can also achieve this without using post data, just the thank you message alone is sufficient.

    Example:

    PDF Link Generation and pass it to another form through post data Image 1 Screenshot 20

    You can use this for your form:

    https://form.jotform.com/70616540635959?pdfLink=https%3A%2F%2Fwww.jotform.com%2Fpdf-submission%2F{id}

    Where pdfLink is the field name from the second form.

    Demo: https://form.jotform.com/70604984390966 (fill this form with your name and the PDF URL will be populated to the second form)

    Hope this helps!

  • RogerYelvington01
    Replied on March 4, 2017 at 3:44 AM

    Is there anyway that have the PDF link that is generated, sent as post data to a field in the following form?  I'm not sure how to write that script.

  • RogerYelvington01
    Replied on March 4, 2017 at 4:23 AM

    Also, I'm trying to transfer post data between these two forms, but it is not flowing through, please help - thank you!

     

    https://form.jotform.com/51105570784959
    https://form.jotform.com/70616540635959
  • Elton Support Team Lead
    Replied on March 4, 2017 at 12:06 PM

    I checked your first form and you have enabled post data which is correct, however, you don't have post URL set as thank you URL in your form that captures the data and process it according to your requirements. Basic PHP knowledge is definitely required on this feature.

    Anyway, here's a simply PHP script I wrote for you that captures the submission ID and construct the PDF link then prepopulate it to the second form after redirection.

    <?php

    $subID = $_POST['submission_id'];

    $pdfLink = "http://www.jotform.com/pdf-submission/".$subID;

    $url = "https://form.jotform.com/70616540635959?pdfLink=".urlencode($pdfLink);

    header("location:$url");

    ?>

    Make sure to update the pdfLink field name (bold text above) with the field name in your form.

    Hope this helps.

  • RogerYelvington01
    Replied on March 4, 2017 at 12:12 PM

    Thanks Elton!

    Where do I enter this PHP script?  

  • RogerYelvington01
    Replied on March 4, 2017 at 12:20 PM
  • RogerYelvington01
    Replied on March 4, 2017 at 12:23 PM

    I made the fields unhidden to show they are not being filled:

    PDF Link Generation and pass it to another form through post data Image 1 Screenshot 20

  • RogerYelvington01
    Replied on March 4, 2017 at 12:42 PM

    P.s.  If you Check it, I had to switch the Thank you page back temporarily so the form will still be able to by used by my staff today.

     

    I only want to permanently switch it over when we have the work flow perfected.

  • Elton Support Team Lead
    Replied on March 4, 2017 at 3:22 PM

    Copy the script and save it as a php file e.g. savepdf.php then upload it to your server. Get the link of the file and set it as your form's thank you URL.

    Sorry, what is it really that you want? Do you want to use the post data method or just prepopulate the second form through thank you URL redirection? Note that these two methods are different. Post data is the harder way while through thank you redirect is the easiest way to achieve this.

    Your link isn't working because of the PDF URL that is not encoded. This breaks the entire query string. You must encode the PDF link first. Here's one that should work for you.

    https://form.jotform.com/70616540635959?memberName={memberName}&staffName={staffName}&homeClub={homeClub}&memberUpdates={memberUpdates}&bestContact={bestContact}&memberEmail={memberEmail}&pdfLink=https%3A%2F%2Fwww.jotform.com%2Fpdf-submission%2F{id}

  • RogerYelvington01
    Replied on March 5, 2017 at 9:00 PM

    That worked, thank you!

  • liyam
    Replied on March 6, 2017 at 12:10 AM

    On behalf of Elton, you are welcome.

    Feel free to let us know if you have other questions.

    Thanks.