You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[5.x]: Validation Error thrown "slug cannot be blank" on inline matrix fields with a single required entry type were the title is hidden, the slug is in the URI
#14947
Closed
brionwolf opened this issue
May 6, 2024
· 2 comments
I realize this is a very niche issue, but sharing: craft throws a validation error stating "slug cannot be blank" on matrix fields where Site settings include the entry's slug in the URL Format, the "Min Entries" is set to greater than one, the "View mode" is As inline-editable blocks, and the title/slug are hidden fields on the Associated Entry Type.
Steps to reproduce
Create an entry type with various fields
Set the Title and slug to hidden, and include logic for creating a title (Doesn't matter if the logic is just a common string, or dynamic based on custom fields).
Associate the entry type with a matrix field as the only entry type
Set an Entry URI format that includes the entry's slug.
Set the Min entries option to a number greater than zero
Set the View mode to "As inline-editable Blocks"
Assign the matrix field to a section that can be edited and attempt to create an entry
Expected behavior
Craft creates the Min-Entries set of entries for the matrix field automatically without errors.
Actual behavior
Craft creates a single block (even if the "Min Entries" is set to more than one), throws an error "Could not save entry" (with 404 errors in Yii console) when attempting to autosave, and throws a validation error "Slug cannot be blank" when manually saving.
Screencaptures:
Notes/workarounds
Issue doesn't occur if I do not hide the title field (Slug field can remain hidden).
Issue doesn't occur if I set the matrix field view to "As cards" or "As an element index" (where I need to create a new entry for the field either from a slide-out drawer or new tab).
Issue doesn't occur if I use another unique identifier in the URI format (ie: the entry id).
Issue doesn't occur if I set the "Min Entries" field to 0, while still setting the field to "required" on associated field layouts.
Craft CMS version
Craft Pro 5.1.0
PHP version
8.3.4
Operating system and version
MacOS Sonoma 14.4.1 (23E224)
Database type and version
MySQL 8.3.0
Image driver and version
GD 8.3.4
Installed plugins and versions
CKEditor | 4.0.4
The text was updated successfully, but these errors were encountered:
Hi, thanks for reporting! I can replicate this with a matrix in matrix setup where both matrix fields are in “as inline-editable blocks” mode, and the nested matrix has the title and slug fields hidden. I raised a PR for this.
What happened?
Description
I realize this is a very niche issue, but sharing: craft throws a validation error stating "slug cannot be blank" on matrix fields where Site settings include the entry's slug in the URL Format, the "Min Entries" is set to greater than one, the "View mode" is As inline-editable blocks, and the title/slug are hidden fields on the Associated Entry Type.
Steps to reproduce
Expected behavior
Actual behavior
Screencaptures:
Notes/workarounds
Craft CMS version
Craft Pro 5.1.0
PHP version
8.3.4
Operating system and version
MacOS Sonoma 14.4.1 (23E224)
Database type and version
MySQL 8.3.0
Image driver and version
GD 8.3.4
Installed plugins and versions
The text was updated successfully, but these errors were encountered: