Skip to content

[6.x] Fill old input that wasn't flashed by a form submission - #16028

Merged
jasonvarga merged 2 commits into
statamic:6.xfrom
andjsch:fix-16027
Nov 27, 2026
Merged

jasonvarga merged 2 commits into
statamic:6.xfrom
andjsch:fix-16027

Conversation

@andjsch

@andjsch andjsch commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

{{ old }} is null inside the {{ fields }} loop of {{ form:create }} since 6.43.2 while the top-level {{ old }} still works.

Root cause — PR #16013

"Only fill old input into the form that was submitted" gated the per-field old variable behind ! $field->form() || $errors->any(), using this form's error bag having errors as a proxy for "this form was submitted". But Laravel flashes old input on any withInput() redirect — failed logins (user.* bags), custom controllers, addon flows — without a form.{handle} bag. In those cases the loop's old was suppressed while \View\Cascade.php kept exposing the full array at page level.

Fix — new src/Forms/OldInput.php with OldInput::shouldFill($errorBag).

Since a form.{handle} error bag is only ever flashed by that form's own failed submission, it's a reliable attribution signal: old input is filled unless it belongs to a different form's failed submission. This restores old input from all non-form sources while keeping #16013's cross-form isolation.

fixes #16027

@andjsch andjsch changed the title Fix #16027 [6.x] Fix filling old input values not being filled when they don't belong to a form Nov 24, 2026
@daun

daun commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Yeah, it was meant to work like this all along. Wondering why the form isn't defined when looping over the fields?

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jasonvarga jasonvarga changed the title [6.x] Fix filling old input values not being filled when they don't belong to a form [6.x] Fill old input that wasn't flashed by a form submission Nov 27, 2026
@jasonvarga
jasonvarga merged commit 34fbfe6 into statamic:6.x Nov 27, 2026
62 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.

Old input values get lost within fields-loop

3 participants