Old input values get lost within fields-loop
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 50/100
Rechercherichtung
Reproduce with the snippet from the report: form:create exposes old as the full array, and the fields tag with scope="field" should narrow it to the current field's value but returns null instead. Locate the form:create and fields tag implementations and see how old is added to the cascade versus how the loop builds its scoped context. The regression appeared between 6.42 and 6.44, so diff that range; done looks like {{ old }} printing the current field's previous value inside the loop while still being the array outside it.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Bug description
After upgrading from 6.42 to 6.44 I noticed, that input values from previous inputs (old variable) aren't available within the fields loop.
{{ old }} is always null within a field. So something like the below won't work.
<!-- /vendor/statamic/forms/fields/default.antlers.html -->
<input {{ old ?= 'value="{old}"' }} />
<!-- End: /vendor/statamic/forms/fields/default.antlers.html -->
How to reproduce
Before we are within the fields loop, old outputs the whole array of values. Within the loop, old become null whilst it should be the value of the field we are looping.
{{ form:create :in="form:handle ?? form_handle" js="alpine:form" attr:x-ref="form" }}
{{ old | dump }} ===> THIS WORKS as intended: array of all values
{{# Render various form sections. #}}
{{ sections }}
{{ old | dump }} ===> STILL WORKS: array
{{# Render the default-styled fields. #}}
{{ fields scope="field" }}
{{ old | dump }} ===> DOESNT WORK: old is null instead of the value of the current field
{{ /fields }}
{{ /sections }}
{{ /form:create }}
### Logs
```shell
Environment
Environment
Laravel Version: 13.44.1
PHP Version: 8.5.12
Composer Version: 2.10.0
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: Europe/Vienna
Locale: de
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED
Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / daily
Mail: smtp
Queue: database
Session: file
Storage
public/storage: NOT LINKED
Locales
Installed: de, en, sk
LaravelLang\Lang\Plugin: 15.39.2
Locales Version: 2.11.0
Protected: de, en
Publisher Version: 16.9.0
Livewire
Livewire: v4.4.10
Statamic
Addons: 8
License Key: Set
Sites: 3 (Deutsch, English, Slovak)
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 6.44.0 PRO
Statamic Addons
marcorieser/statamic-livewire: 6.0.0-beta.1
rias/statamic-redirect: 4.2.5
schantldev/statamic-newsletter: 6.x-dev
schantldev/statamic-phosphoricons: 2.0.1
spatie/statamic-responsive-images: 6.2.0
stillat/meerkat: 4.0.2
studio1902/statamic-peak-seo: 11.9.6
studio1902/statamic-peak-tools: 9.2.3
Installation
Existing Laravel app
Additional details
No response
- Vorherrschende Sprache
- PHP
- Sterne
- 4.9k
- Forks
- 647
- Ø Merge
- 1 T. 45 Min.
- Gemergte PRs (30 T.)
- 221
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus statamic/cms
-
forms ui
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
accessibility
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
Maintainer antworten meist innerhalb von 1 Tag
-
antlers
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag
-
Nav: link to the site root with an anchor (/#section) gets is_parent on every pageEvtl. vergeben @duncanmcclean hat das heute übernommen. Offennavigations
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
-
Multiple Choice and Checkboxes no longer offer "Inline", but the default views still use itEvtl. vergeben @duncanmcclean hat das heute übernommen. Offenforms
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
sync-en
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 86/100
Maintainer antworten meist innerhalb von 1 Tag
-
Selection on a line without a docblock tag drops trailing characters (data provider attribute)Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
vimeo/psalm#15150 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
taskforcesh/bullmq#5238 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itEvtl. vergeben @bfs2021 hat das heute übernommen. Offenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Automattic/jetpack#55517 ·
Maintainer antworten meist innerhalb von 1 Tag