Questions tagged as ['webforms']
I have a webform in my drupal website. I am uploading a text and pdf file through it. Now I am displaying all the content in a list using a block which is accessible for everyone. It's working fine.
So for every submission there is of-course a node created dynamically. Like - http://localhost/mysite/webform/upload/submissions/3 So it can be 3, 4, 5 whatever as uploading goes on. Now i have to restri ...
I'm developing my first webform handler and I need to access the submitter of the webform submission in the postSave
method.
I know I can get the webform submission ID with $webform_submission->id()
, but I can't figure out how to get the submitter. As far as I know, $webform_submission->getWebform()->getOwner()
is NOT what I'm looking for, because it tells me the owner of the form, not th ...
I created a custom webform element, It works perfectly, but when I add a table form element, It is not showing
My Code :
<?php
namespace Drupal\webform_mapper\Plugin\WebformElement;
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\DependencyInjection\DependencySerializationTrait;
use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Plugin\WebformElementBase;
use Drupal\we ...

In my AJAX form the user has to do a validation as he needs a code to enter the rest of the form (it has 3 pages or more). I have an handler to validate this and this same handler uses that code to do get a node:
// ON the handler validate()
$code_valid= $this->sessionManager->get('code_valid');
if (empty($code_valid))
{
$this->handlerProperty = $this->contentService-> ...

I have setup our site to allow files to be uploaded and attached to the submission of the webform. I have the private directory setup with the .htaccess file. That part seems to be ok because when I add the upload element to the webform it creates a folder in the private directory and adds a sample file to it. When I try to use the form and add files to be uploaded and then submit the data it give me th ...

I have a webform with an email field. I am embedding the webform on each node, with a field on the node for the email address.
I implemented hook_form_alter()
in my .theme file that loads the node using $node = \Drupal::routeMatch()->getParameter('node');
.
I can then load the node and get the proper email address and set it in the webform. The problem is that the node is cached for anonymous users. I ...
I'm making a quiz utilising Webform. I would like to use a multi-valued select list for one of the questions, and want to grade the user on any combination of correct answers selected.
Using the Webform Image Select element's default Cute Kittens as an example, for the values of the select:
- kitten_1
- kitten_2
- kitten_3
- kitten_4
I'd like to be able to say a particular combination of selections is the rig ...

I have a webform that we have people fill out two times - for a pre-test and a post-test and I am looking for a way to determine if a pre-test has been taken an if so, set a specific value on form element.
Currently we have people manually select whether they are taking the pre-test or post-test in a webform element, but they are not doing so very accurately. Given we have the data to know that, ...
I made a widget that "generates" fields based on the option chosen of a select field. I got most of the logic done:
1- An option is chosen from this field:
$element['value'] = [
'#type' => 'select',
'#options' => $this->getBreakpointsGroups(),
'#default_value' => $value,
'#ajax' => [
'callback' => [$this,'updateBreakpoint'], // don't forget :: when calling a class method ...

I'm in the process of setting up a "system" where users can submit their Webforms with accompanying details/files and it gets logged into the Webform>Results>Submissions page. This all works great.
What I'm having an issue with, is taking specific submissions from the full list and forwarding those select few to a specific email address that I indicate (somehow). This email address will va ...
When someone submits a webform that has just two fields (Name and Email) I want the system to send them an email that thanks them for submitting the form and provides a PDF file.
Webform enables emails to be sent to the user that submits the form but is it possible to attach the PDF file?
To clarify the PDF file is not submitted by the user in the webform. The webform only has two fields (Name and ...

I've been testing Drupal 9 and Webform 6.2.0-beta2. After researching a few hours, my understanding is that the current Webform doesn't support checkboxes in custom composite fields tables. Is that correct?
For instance, a field type "checkbox" with multiple options like "red, yellow, blue, and black". Once the form processes, these options don't appear on the page.

Summary
I am collecting survey results - one for a pre-test and one for a post-test and I am looking for a way to automatically generate a calculation on a numerical field in two nodes (one pre-test, one post-test) and store that calculation.
For example in a content type "Survey Result", I have the following two nodes:
Node A:
- field_participant_id: 111
- field_pre_or_post: pre
- field_mean: .5
Node B:
...I am receiving an error on a webform I'm developing. Just to give some insight into the webform, the webform is taking in some data (customer type and monthly water consumption) and calculating the cost for Water, Solid Waste, and Sewer. I'm using computed twigs to calculate those cost, and I'm displaying them on the form. (This is where things get complicated). I am displaying current costs and new cos ...
I am using a webform element 'select_other' in the webform. We got a requirement that the Other field should only appear if certain conditions are satisfied. I already have a Webform Handler In place, and using the alterForm(), I tried to change the #type
value, which removed the Other option, but duplicates the field wrapper property.
Is there any way to change the #type
of a webform element programma ...

I am using Acquia site studio components for web pages. In all the pages I have a pop-up with a webform submit button to enter to the site.
In Webform confirmation settings I have selected the option - URL (redirects to a custom path or URL) and in the confirmation URL textfield [current-page:url]?[current-page:query] is given.
On form submission, it is expected to redirect to the current page with the cu ...
In a View of type "Webform Submissions", I have added a field called "Webform submission: Rendered entity". This displays the entire webform submission (content from all fields in the webform). My problem is that I have a few field elements in the webform that have create/view/update access permissions set to the Administrator role only. This is important because the webform is used by the Commerce Webf ...
I installed Drupal 9.3.5 and configured Webform 6.2. When I try to load the setting and other pages, I get this error.
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "webform.config.libraries" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 206 of core/lib/Drupal/Core/Routing/RouteProvider.php).
Drupal\Core\Routing\UrlGenerator->getRoute() (Line: ...
can someone give me a hint how to influence the "default" display behaviour of a webform submission rendered entity within a view ? i have a webform using multistep pages and details-elements, both appear as detail elements within the rendered entity, which is fine. but they are expanded, and i want to display them collapsed by default. Any idea how to alter the gereneric display behaviour ?

I need to build a form for an event registration where people can select the workshops in order of their preference. In Drupal 7 I used to have a grid with radio buttons, but that does not seem feasible in Drupal 9. So I thought about making the list of workshops draggable and send the final order as part of the registration in the email.
Because the workshops differ every year, it must be relati ...
I have created a "form admin" role with three permissions only: "Access the webform overview page", "Create webforms", "Edit own webform" (Drupal 9.3.7, Webform 6.1.3). The user can create a webform but when trying to add an element then the page goes into "reload loop" (see two screenshots). The issue disappears only if I add "Administer webforms" permission or enable "access webform configuration" for ...
I have this webform submission hook and i want to add a file to it when its submitted. I know how to alter the webform submission but now i have an issue that i want to load a file but i don't know the id, only it's url:
Url: /sites/default/files/assets/filename.pdf
i have tried:
$file_name = Drupal::service('file_system')->basename($filename);
//$file_name gives me the correct name
$tar ...

I'm using Webform in D9 and have a multipage form. In step 2 of the form, I need to show the taxonomy term that was selected in step 1.
I've defined the field that will display it as a computed twig field.
If I simply use
{{ data.my_field }}
I get back the tid.
If I instead put
{{ drupal_field('name', 'taxonomy_term', <tid> }}
I receive the desired text. However, I need the tid to come from t ...

I created, 4 tables with the datatables module, but I need to leave the 4 in a single page or view, I tried with dashboards and with draggable dashboards, but they only work on the administrator side I tried with blocks and other options but I can not publish these tables and that these can be filtered in a single page, someone knows how would be the right way to do this.
Thanks for your answers
...
I'm sure I am missing something really obvious. Drupal 7 + Webform + File (Field) paths.
I am uploading files (jpg, pdf, xls) in a webform and need to append the node NID to the original filename. But I can't seem to find a token for the name of the uploaded file.
Example:
- node/123
- Upload file abc.pdf.
- rename it to '123-abc.pdf'
Tried these but they don't fetch the filename: [node:nid]-[file:origin ...
Not sure if I'm asking the question correctly. Here is the configuration:
- I have a form that contains conditionally hidden fields.
- The conditionally hidden webform fields are marked required.
- On the "condition", I've selected "clear values when hidden".
Repro steps
Step 1
Navigate to the page with the form. The form is initially displayed, the field (a checkbox) upon which the condition is con ...
In a webform I've built, under the Submission settings I have enabled, "Convert anonymous user drafts and submissions to authenticated user," and the help for it says, "If checked, drafts and submissions created by an anonymous user will be reassigned to their user account when they login."
This webform is configured to create a user account after submission using the Webform User Creation handle ...

I am trying to use Drupal Webform REST. I got an error "The 'restful post webform_rest_submit' permission is required." on browser console. I have enabled modules and REST resources as mentioned. I used Authorization, the Auth generated in Postman, using basic auth. I am struggling to use 'x-csrf-token' in postman. I want to use submit the form by an anonymous user. Do I still need Authorization, ...

Problem
I have an Article node with layout builder enabled for content author.
I have webform Subscribe newsletter with ajax enabled.
I add webform Subscribe newsletter to the node twice. So there are 2 same webform added to the node.
When I submit the second form, the confirmation message appear in the first webform.
Expected
Confirmation message should appear in second webform.
What I tried
I tr ...