"Validate related assets" only executed after 2nd Save
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
Description
In my CP I have a few tabs within a section’s entry fields. In a few of those tabs I only have one asset field. Those asset fields all have the "Validate related assets" option turned on. The individual asset volumes these asset fields refer to have a bunch of fields associated with them (categories, text, etc.) that are partly set to required. If I batch-upload a few assets to one of the fields I can save the entry one time after the image thumbnails appear within the field. Only after trying to save the entry a second time or re-entering it will the assets be marked red and the expected "Couldn't save entry" message appears.
Steps to reproduce
- Create asset volume with a few required fields
- Create asset field that refers to the volume created and check "Validate related assets" ("Allow uploading directly to the field" is unchecked)
- Create entry type and associate field with it in an individual Tab
- Go to entry with this entry type and go to the Tab
- Choose "Add …" from asset field, throw a few asset files from HD into CP asset window and mark all
- Click lower right "Select" button to confirm selection
- Image thumbnails appear in the entry field, black type underneath
- Click "Save" on entry
- Witness entry being saved without error message
- Open entry again and go to Tab
- Witness all images having red type underneath
- Hitting "Save" will throw expected message "Couldn't save entry"
Additional info
- Craft version: Craft Solo 3.5.15.1
- PHP version: 7.2
- Database driver & version: MySQL 5.6.38
- Plugins & versions: None
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue in the Craft CP with an asset volume containing required fields, an asset field with “Validate related assets” enabled, and a tabbed entry type. Trace the asset-selection and entry-save flow; done means the first save after selecting assets validates the related assets and shows “Couldn't save entry” instead of saving invalid content.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100