Guide

Form Submit

Submission actions for forms: locked template with a submit button and Cloudflare Turnstile captcha.

Namespace

prc-block/form-submit

Category

design

Inserter preview

block.json example matches the locked structure: core/button (submit) plus prc-block/form-captcha.

Supports

FeatureEnabledDetails
AnchorYes
LayoutYesFlex, horizontal by default. Justification, orientation, and vertical alignment are enabled.
DimensionsYesminWidth (not a default control)
SpacingYesmargin (top/bottom), padding

Attributes

No custom attributes. Inner blocks own their attributes.

Inner blocks

Locked template (templateLock: "all"):

BlockPurpose
core/buttonSubmit button (type: submit, text “Submit”)
prc-block/form-captchaCAPTCHA widget

Allowed blocks: core/button, prc-block/form-captcha

Users cannot add, remove, or reorder template children.

Parent / ancestor

Ancestor: prc-block/form

Uses context: form/displayMessage

Usage

  1. Add inside a Form (often last child, or end of the final Form Page).
  2. Customize button text on the core/button inner block.
  3. Captcha shows by default and hides the button until verification; then captcha hides and the button appears.

Block markup example

<div
	class="wp-block-prc-block-form-submit"
	data-wp-class--captcha-hidden="prc-block/form::context.captchaHidden"
	data-wp-context='{"submitButtonText":"Submit"}'
>
	<div class="wp-block-button">
		<button
			class="wp-block-button__link"
			type="submit"
			data-wp-bind--disabled="prc-block/form::state.submissionDisabled"
			data-wp-text="prc-block/form::state.submitButtonText"
		>
			Submit
		</button>
	</div>
	<div class="wp-block-prc-block-form-submit__captcha">
		<!-- Captcha widget -->
	</div>
</div>

PHP rendering

Server-side via render_block_callback in Form_Submit:

  1. Finds <button type="submit"> in inner content.
  2. Adds disabled binding for submissionDisabled.
  3. Binds button text to submitButtonText.
  4. Wraps with data-wp-class--captcha-hidden.
  5. Stores original button text in data-wp-context.

Frontend interactivity

No standalone view.js. Parent prc-block/form store drives captcha visibility and submission state.

Was this helpful?