On the general download page

/admin/structure/webform/manage//results/download

In the 'Download' section you can select the node on which the form is used to download only the submission from that node.

In the field however you must enter the numerical id of the node, which is not user-friendly.

I've created a small patch that replaces this field with a select in which the mode can be selected by title.

User Acceptance Test

✅ Confirm export 'Submitted to' works as expected

  • /admin/structure/webform/manage/{webform}/results/download

✅ Confirm 'Options limit' handler works as expected
✅ Confirm 'Resend' email form works as expected

  • /admin/structure/webform/manage/{webform}/submission/{webform_submission}/resend

✅ Confirm 'Email' handler options mapping works as expected

  • /admin/structure/webform/manage/test_handler_email_mapping/handlers

✅ Confirm 'Test (Ajax) Element' is working as expected

  • /admin/structure/webform/manage/test_handler_email_mapping/element/add/webform_test_element_properties
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

louisnagtegaal created an issue. See original summary.

jrockowitz’s picture

Status: Active » Needs review
Liam Morland’s picture

Reading the code, it looks good to me.

+        $webform_id = $webform->id();
+        $entity_id_options = $this->getOptionsNodesWithWebform($webform_id);

Perhaps $webform_id is not needed here; instead, inline $webform->id().

jrockowitz’s picture

The problem is that the 'Submitted to' field can be any entity and the select menu is being limited to only nodes.

The only solution to improve the UX would be to use Ajax to update the entity id input based on the selected entity type.

Please review the attached patch.

jrockowitz’s picture

The failing JavaScript test is unrelated. The patch can still be reviewed AS-IS.

  • a3dadaa committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...
jrockowitz’s picture

Same solution with a reusable \Drupal\webform\Element\WebformAjaxElementTrait because it is time to make it easier to create a two-step cascading Ajax element.

  • 1760dad committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...

  • 36429d6 committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...

  • 9a77c0b committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...

  • c2d423d committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...

  • c14dd89 committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...
  • ef1d016 committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...

  • ee4098c committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...

  • bead875 committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...

  • 22ea746 committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...
jrockowitz’s picture

Issue summary: View changes
jrockowitz’s picture

  • 9c482ec committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...
jrockowitz’s picture

  • d2af384 committed on 3095978-download-submissions
    Issue #3095978 by louisnagtegaal, jrockowitz: Downloading submissions...
jrockowitz’s picture

  • jrockowitz authored d16421a on 8.x-5.x
    Issue #3095978 by jrockowitz, louisnagtegaal: Downloading submissions...
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download the latest dev release to review.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

protractor’s picture

Hi folks,

In patch 22 the database query
$entity_ids = Database::getConnection()->select('webform_submission', 's') + ->fields('s', ['entity_id']) + ->condition('s.webform_id', $webform->id()) + ->condition('s.entity_type', $entity_type) + ->execute() + ->fetchCol();
Is not really correct. I have around 180 webform submissions so I get 180 IDs here, but only 6 unique IDs. Some lines later it is checked for no more than 100 IDs to get not to many select items. I think this query should be grouped by entity_id.

Should I make a patch for this here?

Liam Morland’s picture

Your probably just need to add SelectInterface::distinct() to the query.

protractor’s picture

FileSize
630 bytes
Liam Morland’s picture

There is no point using GROUP BY unless you also using an aggregate function. Use DISTINCT.

protractor’s picture

FileSize
631 bytes

No problem, I just done it because of the sortorder at the end. Some times even group by is faster than distinct.