forms – How to use computed twig element in Drupal Webform module to get value from a custom composite element?

I have created a custom composite element by cloning the example module of Drupal 8 Webforms. It has a radio button and 4 select boxes. So when clicking ‘Add” button, another row is being created, and likewise a series of 10 clicks would make the page too lengthy.

I need to list out a selected element ( Product ) in another table beneath the custom composite, and hide the filled row when the ‘Add’ button is clicked.

Since I am relatively new to Drupal 8, I have no idea how to achieve this. I tried using computed twig to fetch the data from products table using the syntax {{data.products.product}} where products is the key of the custom composite element & product is the select field inside the composite element. I didn’t receive any output following the above syntax.

Could anyone help me out here ?

7 – Alter Webform email body

I’m unable to find an example of altering the body of the Webform email confirmation according to the value submitted.
I’ve got in my form a select field, I would like to change the body of the email according to the selected value (not only include the value in the body but change completely the message).

I have thought about something like this but not sure if it works (unable to test at the moment, sorry):

 if (isset($message('params')('email')('eid')) && $message('params')('email')('eid') != 1) {
      if ($message('params')('submission')->data(1)(0) == 'company') {
        $message('body')(0) = 'Thank you .. bla bla.
        Bla bla bla.

Or is it possible to do in form_alter hook or maybe some module ?

How to make a value unchecked if another is checked in Drupal 8 webform

Sorry if there’s a simple remedy for this, but I have two separate checkbox types that both need to be unchecked when the other value is checked. Both have attached sections to them that also need to be hidden when the opposite value is selected.

When I try to set this logic, one value is always checked by default. I need the default value to be unchecked for both of these values.


javascript – why my custom jquery code stopped working on a multipage webform after upgrade to WF x6

I have a long questionnaire as multi-page webform and I do many mostly simple counting and addclass using jquery done via a custom module I made for the purpose. This was perfectly working before on Drupal 8 with WF x5 but not anymore after upgrading to Webform x6 (dev) on latest Drupal 9.02.

The below sample code only works if I move the related form to be on first page while it doesn’t load on later pages!

(function($, load) {
        var a =  $("input.countme:checked").length // count all checked checkboxes with the css class "countme"
        $(".cm_score").val(a)  //update the value of the textfield that has the class ".cm_score" 

Below is myModule.libraries.yml

  version: VERSION
      css/webform.css: { preprocess: false }
    js/wfCount.js: { preprocess: false }    
    - core/jquery

Adding a payment button to the Webform Module

I have been administering drupal sites for a while now, but it looks like I need to get into module development for my next clients needs. Specifically I want to add a Pay option to the form, where a person will have to pay before the form gets submitted (there I need to integrate a payment gateway in the form ). Also after the submission is succesfull the person should be registered to the site.

Would appreciate any pointers on how I can achieve the above two goals. I was looking at adding a custom submit handler by using
hook_form_alter() . is that a good path to follow?

8 – How can I change the date format in the webform submission section?

I know this is a simple question. The rest of the date fields on the site match the right format dd/mm/year.

However, the dates in the submission info section of webforms are in a different format. This is the only part of the website that appears in a different format.
I have read on another thread that this time is stored first as unix timestamps and then displayed in this location. Should I be changes this in the database?

enter image description here

Unable to change the widget for a webform coponent

When editing a webform component (7.x-4.23) selecting a different widget type (e.g. from email to hidden) has no effect.

Change storage path of file element [Webform 8.x-5.19]

My webform allows file uploads, but I want them saved in a specific folder within the private folder hierarchy (private://form_name/submission_id/original_file_name.ext). How do I do this?

I see the “rename files” option, but am unsure what token I could use to maintain the original file name and/or specify the path.

How to fill a dropdownfield of Webform with a view(entity reference) with D8

I have a view to select content from a custom content type with a contextual filter by content ID from URL. I wish to put the result in a dropdown field of my webform.

I can give each page with a webform a different URL and pass on the needed ID.
The view works but doesn’t in the dropdown.

I use Drupal 8.9.2 and Webform Version: 8.x-5.19

8 – Webform module – how to change date format of date field?

How to change date format of date field? I’m using webform module. There is no date format field to set it. Also read somewhere that changing default date format of “short” format will do the job, so I changed “Default short date” format, but didn’t help.

So how to change date format?