Remove disabled attribute/state during submission I would like to find a way to remove the disabled attribute from webform fields inside a custom Handler.

The disabled attribute is currently being applied to webform elements during user input via conditions/states with the UI and I would like to remove this attribute after clicking submit so that these webform fields will submit their values.

I've been looking through the available functions from the WebformhandlerBase: https://git.uwaterloo.ca/drupal-org/webform/blob/8.x-5.9/src/Plugin/WebformHandlerBase.php, but can't find where this attribute exists, and don't see an approach to alter/remove it.

public function validateForm() {} seems like a good moment in time to alter, but I can't find this attribute.

Noting I have success doing this with jQuery but would prefer doing this in my custom Handler

How do you remove a form field attribute (disabled) with a custom Handler after a user clicks submit?
Once you submit a form, you are not able to retrieve disabled inputs (https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set). That said:


You cannot modify input's attributes from server-side since the submission data is already posted.
Developing your solution with jQuery on .submit() function is a good idea (far away from bad practices).
You can also make another work around: instead of disabling you could use readonly="readonly" attribute (https://www.w3.org/TR/REC-html40-971218/interact/forms.html#h-17.12.2)