I created a webform form with drupal 8.

I would like to populate a database table with information from my form before or after submitting.

I guess there must be a hook like hook_webform_pressave () or hook_webform_insert () but I have not found the solution.

Thank you for your help

  • Yes, if you can't find a webform specific solution like answered by @sonfd, the entity hooks you've mentioned should work. Submissions are stored in the entity webform_submission, so a hook would be named like this mymodule_webform_submission_presave().
    – 4uk4
    Commented May 3, 2018 at 12:41

1 Answer 1


Take a look at the answer to Add a custom submission handler to a form. This will tell you how to add a submit handler to a form. You can use the same approach to add a custom submit handler to the webform and then perform the operations you want from the submit handler.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.