Skip to content

Forms Block: Add hidden input field variation#74131

Merged
carolinan merged 1 commit intoWordPress:trunkfrom
SirLouen:patch/70712
Mar 21, 2026
Merged

Forms Block: Add hidden input field variation#74131
carolinan merged 1 commit intoWordPress:trunkfrom
SirLouen:patch/70712

Conversation

@SirLouen
Copy link
Copy Markdown
Member

Closes #57610

Why?

One of the most important fields in any form is the hidden type. This PR aims to add this.

How?

Part of the logic and styles were already implemented but not being used. This PR takes advantage of this with the following additions:

  1. Advanced Text Control, next to Name to set Value. To some extent this mimics the same behavior as Elementor forms.
  2. There was a field template for the component that was targeting the hidden input (but adding hidden in the editor, which made 0 sense). I simply took advantage of it and styled a little bit to resemble the Form Submission Notification block, which happens to have two hidden fields (that only appear on submission). This way, it's clear that there are hidden inputs set in the form, they are selectable without needing to unfold the Document Overview.

Testing Instructions

Very easy to test.

  1. Enable the form experiments in Gutenberg > Experiments > Blocks: add Form and Input blocks
  2. Create a new post
  3. Add a new Form block
  4. Add the Hidden Input block inside the form.
  5. Add a value (in the right controls Block > Advanced)
  6. Save and check the front end
  7. Check the HTML code, and look for the hidden field; it should have the value you set.

Screenshots

image

@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: SirLouen <sirlouen@git.wordpress.org>
Co-authored-by: bradhogan <bradley2083@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the [Package] Block library /packages/block-library label Dec 19, 2025
@SirLouen SirLouen requested review from t-hamano and removed request for ajitbohra and fabiankaegy December 19, 2025 23:05
@SirLouen SirLouen added [Type] Enhancement A suggestion for improvement. [Block] Form (experimental) Affects the form block labels Dec 19, 2025
@SirLouen
Copy link
Copy Markdown
Member Author

Please don't forget to add

Co-authored-by: dhananjaykuber <dhananjaykuber@git.wordpress.org>

As he also did some effort to make this happen.

@SirLouen SirLouen self-assigned this Dec 19, 2025
@SirLouen SirLouen removed their assignment Feb 6, 2026
@carolinan carolinan self-assigned this Mar 17, 2026
Copy link
Copy Markdown
Contributor

@carolinan carolinan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should merge this, but before removing any experimental state, we could reconsider if the Advanced panel is the right place for name and value input.

@carolinan carolinan merged commit 8aee0b9 into WordPress:trunk Mar 21, 2026
50 of 53 checks passed
@github-actions github-actions bot added this to the Gutenberg 22.9 milestone Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Form (experimental) Affects the form block [Package] Block library /packages/block-library [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Experimental form block: add hidden field option

2 participants