I need to do some actions after a new submission for a webform is created. So I have created a new handler, and I'm using the function:

public function submitForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission)

But this functions triggers whenever I edit the webform too. Is there a way to know if it's a new submission?

  • Isn't it when you add the handler through the UI, that you simply can check "is completed" and leave "update" unchecked?
    – leymannx
    Oct 7 '20 at 9:45
  • 2
    With proper autocompletion you can see, that there's $webform_submission->isNew() and $webform_submission->isCompleted().
    – leymannx
    Oct 7 '20 at 9:49
  • I can't find those checkboxes when adding the handler. I'll try the functions $webform_submission->isNew(). Thanks.
    – jmzea
    Oct 7 '20 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.