Automatically download after submission

Created on 20 June 2024, 5 months ago
Updated 12 September 2024, 2 months ago

Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Closed: works as designed

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 5 months 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!

  • Status changed to Closed: works as designed 2 months ago
  • 🇬🇧United Kingdom james.williams

    Closing due to lack of response; I'll presume my response explained why this functionality is not really suitable for this module and what the alternative approaches could be. Let me know if not though!

Production build 0.71.5 2024