Drupal Webform Module Setup for Forms

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1 servicesAll 2065 services
Drupal Webform Module Setup for Forms
Simple
from 1 business day to 3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Drupal Webform Module Setup for Forms

Webform is the most functional forms module for Drupal. Form builder with 50+ element types, conditional logic, multi-step forms, submission handlers (email, webhook, CRM), export answers to CSV/Excel.

Installation

composer require drupal/webform
drush en webform webform_ui -y
drush cr

Creating a Form

Structure → Webforms → Add webform. Name, machine name, description.

Form builder: Elements → add fields by dragging or button. Element types:

  • Text: Textfield, Textarea, Email, Tel, URL, Number
  • Choice: Select, Radios, Checkboxes, Buttons
  • Date/time: Date, Time, DateTime
  • Files: File, Managed file
  • Complex: Address, Composite element, Signature
  • Containers: Fieldset, Details, Section, Flexbox

YAML Element Configuration

Webform stores form structure in YAML, enabling git versioning:

# contact_form.webform configuration
elements: |
  name:
    '#type': textfield
    '#title': 'Name'
    '#required': true
    '#maxlength': 100
  email:
    '#type': email
    '#title': 'Email'
    '#required': true
  phone:
    '#type': tel
    '#title': 'Phone'
    '#input_mask': '+1 (999) 999-9999'
  message:
    '#type': textarea
    '#title': 'Message'
    '#required': true
    '#minlength': 10
    '#rows': 5
  department:
    '#type': select
    '#title': 'Department'
    '#options':
      sales: Sales
      support: Support
      other: Other

Conditional Logic

  company_name:
    '#type': textfield
    '#title': 'Company Name'
    '#states':
      visible:
        ':input[name="client_type"]':
          value: business
      required:
        ':input[name="client_type"]':
          value: business

Email Handler

Settings → Emails/Handlers → Add Email:

  • To: [webform_submission:values:email] (dynamic from form)
  • Subject: New submission from [webform_submission:values:name]
  • Body: use template with Drupal tokens

Webhook Handler

composer require drupal/webform_rest
drush en webform_rest -y

Or custom handler:

// src/Plugin/WebformHandler/CrmWebformHandler.php
namespace Drupal\mymodule\Plugin\WebformHandler;

use Drupal\webform\Plugin\WebformHandlerBase;
use Drupal\webform\WebformSubmissionInterface;

/**
 * @WebformHandler(
 *   id = "crm_integration",
 *   label = @Translation("CRM Integration"),
 *   category = @Translation("External"),
 *   description = @Translation("Sends submission to CRM"),
 *   cardinality = WebformHandlerBase::CARDINALITY_SINGLE,
 *   results = WebformHandlerBase::RESULTS_PROCESSED,
 * )
 */
class CrmWebformHandler extends WebformHandlerBase {
    public function postSave(WebformSubmissionInterface $webform_submission, bool $update): void {
        $data = $webform_submission->getData();

        \Drupal::httpClient()->post('https://crm.example.com/api/leads', [
            'json' => [
                'name'    => $data['name'],
                'email'   => $data['email'],
                'message' => $data['message'],
                'source'  => 'drupal-webform',
            ],
        ]);
    }
}

Inserting Form on Page

{# In twig template #}
{{ drupal_entity('webform', 'contact_form') }}

Or via block: Structure → Block placement → Webform block.

Export Answers

Webforms → [form] → Results → Download. Formats: CSV, Excel, JSON. Supports filtering by date and status.

Timeline

Creating and configuring a form with email handler and basic conditional logic — 3–5 hours. Custom CRM integration handler — plus 1–2 days.