Put the below code in youractivetheme.theme file

/**
* Implements hook_preprocess_HOOK().
*/

function [theme]_preprocess_webform_confirmation(&$vars) {
if ($vars['webform']->id() == 'put your webform id') {
// Set your custom message here
$markup = t('Thank you for your feedback.');
$vars['message']['#markup'] = $markup;
}
}

/// How to customise the message based on the submitted value

/**
* Implements hook_preprocess_HOOK().
*/

function [theme]_preprocess_webform_confirmation(&$vars)
{
if ($vars['webform']->id() == 'put your webform id')
{
// Get the submitted form value using the below command
$submittedFormValues = $vars['webform_submission']->getRawData();
if($submittedFormValues['field_name'] == 'some condition or value'){
$markup = t('display message 1');
}
else
{
$markup = t('display message 2');
}
// Set your custom message here
$vars['message']['#markup'] = $markup;
}
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.