With a standard HTML form in Drupal 8, how can I get the submit message to post in the "Status Message" block? I have a form that I want to add JS to so that when it is submitted, the confirmation text is fired into the "status messages" block or any block in the help/admin block section.

Basically, here is the form and upon submit, I want the post message to display in a block rather than the user be sent to another page.

&lt;form name="email_signup" action="http://example.com"&gt;
&lt;input type="text" name="emailAddress" placeholder="Enter email"&gt;
&lt;input type="submit" value="Join"&gt;
&lt;/form&gt;
You should create this form through the Form API in a module, then in the form submit handler you can use Messenger to do this.

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Messenger%21MessengerInterface.php/function/MessengerInterface%3A%3AaddMessage/8.6.x

You can see that drupal_set_message now routes through it:

function drupal_set_message($message = NULL, $type = 'status', $repeat = FALSE) {
  @trigger_error('drupal_set_message() is deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. Use \\Drupal\\Core\\Messenger\\MessengerInterface::addMessage() instead. See https://www.drupal.org/node/2774931', E_USER_DEPRECATED);
  $messenger = \Drupal::messenger();
  if (isset($message)) {
    $messenger
      -&gt;addMessage($message, $type, $repeat);
  }
  return $messenger
    -&gt;all();
}


This is how flash/status updates are created.