Displays a message after successful form submission. Hidden until state.formMessage is set.
Namespace
prc-block/form-message
Category
forms
Inserter preview
block.json example includes a core/paragraph (“Thank you for your submission!”), matching the default template.
Supports
| Feature | Enabled | Details |
|---|---|---|
| Anchor | No | |
| HTML editing | No | |
| Reusable | Yes | |
| Interactivity | Yes | |
| Spacing | Yes | blockGap, margin (top/bottom), padding |
| Color | Yes | Background, text, link, button |
| Typography | Yes | Font size, font family |
Attributes
No custom attributes. Content is composed with inner blocks.
Styles
No registered style variations in block.json. Stylesheet supports is-style-overlay for a fixed full-screen overlay.
Inner blocks
Default template: core/paragraph (“Thank you for your submission!”).
Allowed: core/paragraph, core/heading, core/group, core/buttons, core/button, core/separator, core/image, prc-block/form-input-text
form-input-text is supported for message-state inputs (for example email collection inside the message layer).
Parent / ancestor
No explicit ancestor in block.json. Designed for use inside prc-block/form (or Mailchimp form wrappers in block-library).
Usage
- Add inside a form structure.
- Compose message content with inner blocks.
- Recommended: Bind a paragraph’s content to the Form Result Message source (
prc-block/form-message). New form-message blocks default to this binding. - Legacy: Template tokens
{{message}},{{form message}},{{form-message}}, or{{form_message}}are replaced at render with a span bound tostate.formMessage. - The block stays hidden until
state.formMessageis truthy.
Block markup example
With block binding (recommended):
<!-- wp:paragraph {"metadata":{"bindings":{"content":{"source":"prc-block/form-message"}}}} -->
<p data-wp-text="state.formMessage"></p>
<!-- /wp:paragraph -->
With legacy token replacement, the wrapper receives data-wp-class--is-displaying-form-message="state.formMessage".
PHP rendering
Server-side via Form_Message:
- Wraps inner content with interactivity bindings.
- Replaces legacy tokens with
<span data-wp-text="state.formMessage"></span>. - Bound paragraphs get
data-wp-textviainject_message_bindingonrender_block.
Frontend interactivity
No standalone view.js. Parent form store sets state.formMessage after submit.
Related
- Form
- Form Submit
- Mailchimp Form (block-library)