Skip to content

[6.x] Fix hidden fieldtypes ignoring their field conditions - #15132

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
lazerg:fix/issue-15131-hidden-field-default
Aug 6, 2026
Merged

[6.x] Fix hidden fieldtypes ignoring their field conditions#15132
jasonvarga merged 1 commit into
statamic:6.xfrom
lazerg:fix/issue-15131-hidden-field-default

Conversation

@lazerg

@lazerg lazerg commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

A field with a hidden fieldtype saves its default value even when its conditions say it shouldn't be there. The reporter uses one to set protect: password only when a toggle is on, so after upgrading to v6 every entry save wrote the password scheme and locked the page behind a 403.

Field conditions are evaluated in Publish/Field.vue, which registers whether the value should be omitted from what gets submitted. Since #12970, Publish/Fields.vue filters hidden fieldtypes out of the list before it renders, so their conditions are never evaluated and their values are never omitted. Before that they were rendered like any other field and just hidden with CSS.

This moves the form submission check into the field itself, so hidden fieldtypes take part in field conditions again while still being invisible everywhere except a form submission.

Fixes #15131

@lazerg
lazerg force-pushed the fix/issue-15131-hidden-field-default branch from f4166e4 to 4349408 Compare August 6, 2026 12:58
@robdekort

Copy link
Copy Markdown
Contributor

Thanks for this!

@jasonvarga
jasonvarga merged commit 3df65b4 into statamic:6.x Aug 6, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hidden fields always save default value

3 participants