1

I have a white paper PDF file that I want visitors to be able to download, but only after they've submitted a form with their contact information. How can I do this in Craft?

Currently, I'm using the Sprout Forms plugin to build a form, and I've set the redirect for the form to a template containing the download link. This does work, but seems clunky, and any visitor who has the URL for the download page can visit it without submitting the form.

How can I require a form submission before displaying the template with the download link to the visitor?

1 Answer 1

1

Not terribly familiar with Sprout Forms, but it looks like you could gate the download with a query string parameter, like in Sprout Forms' Thank you Page example

Example:

Add this to your form:

<input type="hidden" name="redirect" value="/DOWNLOAD_PAGE?submitted=true">

and then in your download link template:

{% if craft.request.getParam('submitted') == 'true' %}
    DOWNLOAD_LINK
{% else %}
    Please submit the form here LINK_TO_YOUR_FORM to access this whitepaper.
{% endif %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.