drupal

Disable elements on drupal webform

Drupal 8 provides an easy way to simply edit the component or element on the drupal webform and disable elements using the checkbox displayed on the form.

 

disable elements

However, there could be different scenarios where we might need to disable few elements on specific cases that might not available on drupal webform conditional. Eg - Disable elements for certain user roles.

Hidden Element not submitted on Drupal Form

Hidden elements can be easily created on a Drupal form. When the form is submitted, $form_state variable seems to be holding the value of this element in various hooks, "form_alter", "validate", etc.

Note that if you have an ajax call or a jquery code which assigns or modifies the value of the hidden element, this value will not be sent when the form is submitted. For eg, An hidden element is created from -