Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation errors on Grid items are hard linked to the item index instead of the item itself #10704

Open
TimDirks opened this issue Aug 27, 2024 · 0 comments · May be fixed by #11341
Open

Validation errors on Grid items are hard linked to the item index instead of the item itself #10704

TimDirks opened this issue Aug 27, 2024 · 0 comments · May be fixed by #11341

Comments

@TimDirks
Copy link

Bug description

When creating a Grid field with any field as its "child" that has validation rules, the errors corresponding to said rules are set on the item index and not the item itself. Meaning that when I have 3 grid items and I get an validation error on item 2 (thus item 1 and 3 being valid), when I then remove item 2 the validation error doesn't go away but instead item 3 is now in the position of where item 2 was and now the validation error appears on item 3.

How to reproduce

Create a simple grid field with a field having a validation rule as its "child". YAML example:

handle: grid_field
field:
  min_rows: 1
  type: grid
  display: 'Grid Field'
  localizable: false
  fields:
    -
      handle: text
      field:
        type: text
        display: Text
        localizable: false
        validate:
          - required

Use it in an entry with some empty rows, try to save, see the validation errors and try to remove those rows with validation errors.

A screencap to hopefully provide more clarity:

Screen.Recording.2024-08-27.at.09.59.00.mov

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.10.0
PHP Version: 8.2.22
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: <project>-statamic.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: null
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 3
Sites: 38 (Default, NL, EN, and 35 more)
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.21.0 PRO

Statamic Addons
aerni/advanced-seo: 2.5.3
rias/statamic-redirect: 3.7.1

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants