Automatically download after submission

Created on 20 June 2024, 11 days ago

Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡³China TammyCao

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @TammyCao
  • πŸ‡¨πŸ‡³China TammyCao


    Automatically download after submission when you checked here.

  • Status changed to Needs work 11 days ago
  • πŸ‡¬πŸ‡§United Kingdom james.williams

    I'm not sure this is the right module for this functionality. There are already a number of other similar modules β†’ , each of which suits slightly different use cases. For this case, I wonder if https://www.drupal.org/project/webform_confirmation_file β†’ would be a better fit for you? That already sends the file to the browser after submission. (Though its upload method, just a text entry box, won't suit all types of file - but then maybe improvement is better targeted there.)

    WPD quite deliberately supports providing multiple files through the browser as one of its unique points in comparison to the others, so I do suggest that any additional functionality to it needs to work with that - which makes it difficult to support automatic downloads. If there were multiple handler instances, each with their own file, the javascript you have implemented would only ever click the first link. If anything, perhaps files from multiple WPD handlers using this new proposed setting could be provided together in a single zip file?? I think a meta http-equiv refresh would also be worthwhile, so that the solution doesn't rely on javascript.

    Alternatively, I've never tried it, but I wonder if the webform confirmation page could just be set to point at the token for one of the Webform Protected Downloads handlers' files? That might be a much simpler approach. Forcing users to immediately download a file does leave the confirmation page setting a bit redundant otherwise, as otherwise you're not just adding functionality to the webform experience, but fundamentally changing the journey? Are you deliberately wanting to make it a two-step completion: show the confirmation, but also force a file download? Or is the file download enough? (Which is what webform_confirmation_file does - meaning the user never reaches the confirmation page.)

    So in summary, it may be that this idea is better suited to a different module, or it needs work to be suitable in this module. But I can certainly see the value in providing downloads automatically, I'm open to it if it can fit into this module's existing use case!

Production build 0.69.0 2024