Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Form

By editor , 28 March, 2018

Increment or Decrement number of Fields Dynamically using Form API and Ajax

Tags

  • Drupal 8
  • Code
  • Form
  • JavaScript

In this example, we will use a field to get tags list, the number of tags dynamic.

By editor , 26 March, 2018

Taxonomy form autocomplete, Create taxonomy term field with FAPI

Tags

  • Drupal 8
  • Code
  • Taxonomy
  • Form

Simple taxonomy autocomplete field.

Example:
$form['tagtest'] = [
  '#type' => 'entity_autocomplete',
  '#target_type' => 'taxonomy_term',
  '#title' => 'Taxonomy Term',
];

By editor , 12 September, 2017

Autocomplete function for textfield of Form API

Tags

  • Drupal 8
  • Code
  • Form

First, Create autocomplete controller and the route

Example of the controller : DefaultController.php

<?php

namespace Drupal\mymodule\Controller;

By editor , 16 March, 2017

Avoid Spam form submissions - (Easy way of form Anti-Spam)

Tags

  • Drupal 8
  • Code
  • PHP
  • Form
By editor , 28 November, 2016

Add a Form in to a Basic Controller

Tags

  • Drupal 8
  • Code
  • Form
  • Drupal 9

NOTE: I don't know this is the best practice, anyway it's working !!!.

By editor , 26 August, 2016

Tips for Form API of Drupal 8

Tags

  • Drupal 8
  • Drupal 7
  • Code
  • Form

Add html after a field

(#field_prefix and #field_suffix).

By editor , 10 May, 2016

Add Remove Fields Dynamically using Form API and Ajax

Tags

  • Drupal 8
  • Code
  • Form

Example: Add/Remove 'test' Field depending on 'switch' field

By editor , 15 January, 2016

Form redirection on submit

Tags

  • Drupal 8
  • Code
  • Form

Example : (Insert this line in to your form submitForm() methode)

Redirect to the user page ( Redirection on form submit)
$form_state->setRedirect('user.page');

By editor , 15 January, 2016

Show a Form on another page

Tags

  • Drupal 8
  • Code
  • Form

 

Example :  Display user login form on a page

By editor , 15 January, 2016

Create a Form with Drupal 8 using Form API

Tags

  • Drupal 8
  • Code
  • Module
  • Form
  • Drupal 9

Step 1:  Create a module. (Example)

Pagination

  • 1
  • Next page
Form

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer