Skip to content

Fix "NestedForm Inherits Values from Parent Form" Bug#8

Open
apple-bears wants to merge 1 commit intoswe-productivity:developfrom
apple-bears:fix/nestedForm-name-bug
Open

Fix "NestedForm Inherits Values from Parent Form" Bug#8
apple-bears wants to merge 1 commit intoswe-productivity:developfrom
apple-bears:fix/nestedForm-name-bug

Conversation

@apple-bears
Copy link
Copy Markdown

Related Issue

#4

Updates

Create a dummy model that prevents nested form fields from inheriting
values from the parent form's model. This is necessary because:

  1. Form widgets use getLoadValue() which falls back to $this->model when data is falsy (FormWidgetBase line 150)
  2. When a nested form field (e.g., "name") doesn't exist in the nested data array, it would otherwise check the parent model and inherit the parent's "name" value
  3. The Form widget requires a model instance, so we provide a dummy one that always returns null for attributes

Screenshot

The repeater form doesn't show the page name as shown in the issue.
Screenshot from 2026-03-01 13-11-32

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.

1 participant