Questions tagged as ['webforms']

One of the modules used for surveys, contests, personalized contact forms, or petitions is the Webform module.
Score: 0
user3099225 avatar
Restrict access to webform submission nodes for anonymous
cn flag

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 ...

Score: 0
Interlated avatar
How do you use 'basic markup' in a webform default value?
km flag

How can you use 'basic markup' in a webform default value? The goals is to format the default text.

Steps

  1. Create a Basic HTML element
  2. Edit the element
  3. Using the 'advanced' tab set the default value.

Only plain text is allowed in this field. Any markup is rendered as markup not as HTML

Markup element default

Score: 0
Carlos avatar
How do I get the submitter of a webform submission?
in flag

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 ...

Score: 0
Bouhouch Khalid avatar
Web form Custom element
jp flag

I created a custom webform element, It works perfectly, but when I add a table form element, It is not showing enter image description here

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 ...
Score: 0
How to persist webform validation result in multistep ajax webform handler?
dk flag

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-&gt ...
Score: 0
Webform upload files issue
ng flag

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 ...

Score: 2
Node ID caching on hook_form_alter()
in flag

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 ...

Score: 0
Cameron avatar
Webform Conditions for a multi valued select
cn flag

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:

  1. kitten_1
  2. kitten_2
  3. kitten_3
  4. kitten_4

I'd like to be able to say a particular combination of selections is the rig ...

Score: 0
Webform Conditional based on previous webform entry
us flag

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,  ...

Score: 1
Burly Uranus avatar
How to add an unique wrapper id to a widget element?
lb flag

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 ...
Score: 0
Is there a way I can forward specific Webform Submission Results (from admin) to an email address I enter?
cn flag

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 ...

Score: 0
websoft avatar
Send email with PDF attachment to user that completes the webform
cn flag

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  ...

Score: 0
Checkboxes in Webform Custom Composite Table
us flag

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.

enter image description here

Score: 0
Perform and store a calculation from a common field in two different nodes
us flag

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:

 ...
Score: 0
rosendo.fig avatar
"Object of class Drupal\Core\Render\Markup could not be converted to number"
in flag

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 ...

Score: 0
Samuel Fernandez avatar
How do I programatically change a webform's element type?
ng flag

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 ...

Score: 0
Webform Confirmation settings on form submission not working
ng flag

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 ...

Score: 0
hockey2112 avatar
Create alternate "View Modes" for Webform Submissions?
tr flag

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 ...

Score: 0
jayaprakash R avatar
I cannot load some pages after configuring CiviCRM Webform
pk flag

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: ...

Score: 0
Tobias Jeschke avatar
Webform rendered entity display
cn flag

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 ?

Score: 0
Select by drag and drop
iq flag

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 ...

Score: 0
Nikodem Miranowicz avatar
User with only "Edit own webform" permission cannot add elements to own webform
ph flag

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 ...

Score: 0
simp you avatar
how to get file id
ph flag

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 ...
Score: 0
Get a term name with twig_tweak drupal_field using a dynamic value
cl flag

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 ...

Score: 0
How to add multiple html tables in one view or page
kp flag

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

 ...
Score: 0
Append info to original filename when uploading file in webform (filename token)
br flag

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 ...

Score: 0
sea26.2 avatar
How to reset webform field validation state?
om flag

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".

enter image description here enter image description here

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 ...

Score: 0
Delty avatar
Webform Submissions settings, "Convert anonymous user drafts and submissions to authenticated user" doesn't seem to work
br flag

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 ...

Score: 0
Drupal Webform REST
jp flag
Rdb

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, ...

Score: 2
Problem with same webform added multiple time in a page
th flag

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 ...