5

The Webform module just extends Drupal's Form API. Most of the elements available to a webform can be used in custom-built forms. For example, you can use the WebformMultiple element in any FAPI form. @see https://git.drupalcode.org/project/webform/blob/8.x-5.x/src/Element/WebformMultiple.php


2

Don't think you can query webform fields like entity fields, but it should be possible in an SQL select query: $submission_storage = \Drupal::entityTypeManager()->getStorage('webform_submission'); $query = \Drupal::database()->select('webform_submission_data') ->fields('webform_submission_data', ['sid']) ->condition('webform_id', '...


1

On your webform submission settings on scroll down, then check "Allow users to view a submission using a secure token? " then as it has been mentioned there Allow users to view a submission using a secure token If checked users will be able to view a submission using the webform submission's URL appended with the submission's (secure) token. The '...


1

I would use a technique similar to what is described in my answer to "How can I compare data comparison with values submitted in a webform?". For short: Add an extra Rules Action to Add a variable, with a value assigned to it equal to your Webform data you want to use (and with an appropriate data type). You'd need 1 such variable for each Webform component ...


1

To stream (and protect) the file, you should try using https://www.drupal.org/project/webform_confirmation_file


1

Instead of creating different webforms for each file, you could just have one form that can handle this. Here is my suggestion: Make all links to your whitepapers to load a webform and pass the filename as a parameter for your webform. You can then store that on a hidden field on the form. Create a custom submission handler for your webform to trigger a ...


1

I solved the above issue by creating a new Webform Exporter plugin, extending the default "Delimited text" in a custom module. I assume you download them in either CSV or MS Excel file format. I've only tried the below for the CSV export, but I see no reason for it not working for MS Excel ones as well. The idea in a short summary is: Create a custom ...


1

So I spent a full day investigating on something similar. Kudos to @jrockowitz for providing the right direction. Below is something I wrote to work. $webforms = \Drupal::entityTypeManager() ->getStorage('webform') ->loadByProperties([]); $new_field = [ 'new_field'=>[ '#type' => 'textfield', '#title' => 'Question one',]]; ...


1

As I noted in the comments of the answer by jrockowitz, postSave() will fire multiple times in certain situations. I ran into this issue after installing the webform_pardot module, which creates it's own submission entity that references the original webform submission entity via an entity reference field. When the pardot submission is saved, the webform ...


1

Here's a simple Rule that will react on a webform submission and create a new node of type "Article" with the article title set to the submission time to show how webform submission values may be used to set node values. This Rule assumes you have the default webform type "Contact" enabled. Use the Rules 8.x-3.x-dev version and you can import this Rule and ...


1

I know this is a late reply, but I haven't seen the following approach mentioned anywhere else. I think the above answers are a bit hacky. What I do is edit the webform submission html twig file with my own markup, right above the {{form}} line. So in essence, I would access the name input and label by typing {{form.elements.name}} between my html tags, and ...


Only top voted, non community-wiki answers of a minimum length are eligible