• Resolved BenRacicot

    (@benracicot)


    Hello,

    Can I redirect a user to the PDF after they successfully submit a form?

    Also, I have 3 buttons on one page, each for different PDF downloads. If I create 3 different, dedicated forms is there a way to trigger each form programmatically per button? (instead of a shortcode)
    I am currently using a JavaScript onclick event:
    <button type="button" class="blue-btn lead" onclick="window.location='<?php echo bloginfo('url'); ?>/download/';">Download</button>
    Thanks for your time.

Viewing 1 replies (of 1 total)
  • Hi Ben,

    You can absolutely redirect a user to a PDF after they’ve submitted a form. To do this, you’ll need to make sure your Confirmation setting is set to Redirect to URL (more details in this tutorial: https://wpforms.com/docs/setup-form-confirmation-wpforms/).

    Then, to get the URL of your PDF, you can upload it to your WordPress Media Library, click the PDF in the library to open its Attachment Details screen, and look to the URL field (shown in this screenshot: https://cloud.supportally.com/2Q3z0g143J3e).

    Just note that if you do this approach, it will feel to the user like they’ve been redirected off-site (this is because the PDF page won’t show your site header). An alternative to consider is using a Confirmation Message with a link to your PDF. Here’s a screenshot of an example: https://cloud.supportally.com/402P2s173k2s (target=”_blank” will open the PDF in a new tab, but you’d use the same link as for the redirect approach).

    For the second part of your question, I’m not quite clear on what you’re looking to do. Would you like to redirect the user to a new page, where the form is embedded, or are you looking to open the form in a lightbox/popup? For the first, the best method is just to include a normal link for the relevant page. For the second, it depends what lightbox/popup plugin you’re using (each has slightly different triggers).

    I hope that helps! ??

Viewing 1 replies (of 1 total)
  • The topic ‘Using code instead of a shortcode for several download-after-submissions’ is closed to new replies.