Form #states API doesn't work when editing

Created on 8 November 2019, almost 6 years ago
Updated 19 August 2025, about 1 month ago

Problem/Motivation

I'm using form #states api to show/hide fields conditionally. This is working as expected when I use an Entity Form.

However once I've added a node and edit it the states API conditionals no longer work.

It looks like hook_form_FORM_ID_alter() is getting called when editing an existing form but the conditionals are not being applied.

I've attached a video for reference.

Steps to reproduce.

1. Create a node with conditional logic using form #states api.
2. Add that node using Entity Browser.
3. Edit that node using Entity Browser, the #states conditionals do not work.

🐛 Bug report
Status

Closed: works as designed

Version

2.0

Component

Core API

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024