I am using drupal 8 and webform 8.x-5.0-beta25. I have a multistep form with ajax enabled, 5 pages.

I need to alter the confirmation message but I haven't been able to figure it out. What I want to achieve is change the message depending on some form values the selected on the last question. I've created a custom module and extended the WebformHandlerBase and created a confirmForm function but I am not seeing anything once the form is submitted.

Again, it is submitting through ajax so I am not sure if that has anything to do with it.

Here is what I have tried so far


namespace Drupal\cbed_ux\Plugin\WebformHandler;

use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\WebformHandlerBase;
use Drupal\webform\WebformSubmissionInterface;
use Drupal\webform\WebformInterface;
 * Form confirm handler.
 * @WebformHandler(
 * id = "quiz_handler",
 * label = @Translation("Quiz Handler"),
 * category = @Translation("Quiz Handler"),
 * description = @Translation("Quiz Webform handler."),
 * cardinality = \Drupal\webform\WebformHandlerInterface::CARDINALITY_UNLIMITED,
 * results = \Drupal\webform\WebformHandlerInterface::RESULTS_PROCESSED,
 * )
class QuizWebformHandler extends WebformHandlerBase {
  public function confirmForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
    drupal_set_message ('submitted!!');

The form submits, but I do not see my kint or set message

1 Answer 1


Did you attach your WebformHandler to your webform via /admin/structure/webform/manage/WEBFORM_ID/handlers?

Your QuizWebformHandler::submitForm method does not match the WebformHandlerInterface::submitForm definition and should be throwing a fatal exception.

  • 1
    Ah, I didn't even know that was a thing! I assumed these got picked up regardless. Ok, so when I go to that handlers tab, I am get the WSOD. I did change from submitForm to confirmForm as you see in my edits. My error log is saying [Semantical Error] Couldn't find constant \Drupal\webform\WebformHandlerInterface::CARDINALITY_UNLIMITED
    – Ronnie
    Dec 12, 2017 at 19:04
  • 2
    nvm, solved it. The namespace changed: drupal.org/node/2885570. When I click add handler for quiz handler, I am getting a 500 ajax error and it says namepsace has to be the first declaration in QuizWebformHandler.. It is though so not sure what is up
    – Ronnie
    Dec 12, 2017 at 19:06
  • 1
    I have it working now. I must have been looking at old docs because all the namespaces were incorrect for the version I was using. Thank you!
    – Ronnie
    Dec 12, 2017 at 19:14

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.