Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

I need to set up a form where users submit information in order to download a file that should be downloaded as soon as they click the submit button (which is going to say "Download").

Is this possible? I know I can always have the form redirect to a page with the download link, but ideally clicking download would start the download and submit the form at the same time.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

You'll want to set the form redirect page to allow PHP and set http headers to force download of the PDF. Something like this.

You can, of course, mix EE tags in that PHP-enabled template, so you could include a value in your segment variables to look up the right PDF to download, etc. Lots of options.

share|improve this answer

Why not use jQuery to trigger a get request for the download URL?

share|improve this answer

I think, it would be fairy easy by using the hook either freeform_module_insert_end or freeform_module_insert_begin. And in this hook you can use the force download of "download" helper.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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