-
Notifications
You must be signed in to change notification settings - Fork 639
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
[5.x]: Getting value invalid on save for existing entries after adding new dropdown field #14731
Comments
I’m not able to reproduce this. For me it’s working exactly as described in #13540, where the field is initially marked as changed when loading the entry, with the default value preselected, and the field is saved with that value once I save the entry, regardless of whether I make changes to other fields as well. Are you able to reproduce this consistently? Can you think of anything else that should be added to the steps to reproduce? |
I was able to replicate this, but only if I added a dropdown field (with a default value selected) to an entry that uses a matrix field with inline-editable blocks. I raised a PR for this. Adding a dropdown field to an entry outside of a matrix field or to a matrix field that uses another view mode (e.g. cards) works as expected for me. If you’re experiencing the issue without the matrix field or in a matrix field that uses a view mode other than inline-editable blocks, please provide some additional info on how to replicate it, and I’ll look into that as well. |
I have reproduced it with my setup in matrix fields, however, it's in two matrix levels:
I have reproduced the error as follows:
|
@mortenta Can you change your |
@brandonkelly I'm sorry, it doesn't seem to fix the problem. I changed the composer.json file to:
then run composer update, verified: No need to do any php craft xxx/xxx right? Then did the same procedure once again, just changed the handle and values to be sure nothing was stuck from the last test. Still got the same result. |
Would you mind running |
@brandonkelly I have run composer update and done the same test, unfortunately with the same result. If you want, I could email you my project files and possibly a screen recording? |
That would be great! Can you send a database backup and Composer files over to support@craftcms.com? And just point out which section you’re seeing this in. |
I've sent an email with the dump and files now. |
OK so the issue here is:
It’s definitely awkward that to resolve this, you must open the nested entries’ slideouts and then save them without manually changing anything. Not a great UX. It would also be a little unexpected for Dropdown fields to start setting themselves to the default value whenever they are invalid, rather than registering a validation error. So I’m not completely sure how we should solve this. We’ll discuss internally. In the meantime, you can resolve it yourself by running the following command: php craft resave/entries \
--field blockCardsContainerCard \
--type blockCardsContainerCard \
--set yetanotherdd --to "=bx" --if-empty |
Awesome, thanks! |
We discussed this today and decided to keep things mostly as-is, and to document how to use the One thing that needed to be improved is, |
Craft 4.9 and 5.1 are out with that |
I've ran these commands:
But the child entries for each matrix field still has errors when saving the main entry. I thought I needed the type as well so I tried this |
@DynamiteGoesBoom What error are you getting? |
No error running the command via the CLI but the entries still show red when saving. |
And the red entries don’t have any sort of error message beside them? Any chance we can get our hands on your database and Composer files, so we can look into it on our end? If so, please send them to support@craftcms.com |
What happened?
Description
After adding a new dropdown field to an entry type that is already in use by entries, I get an error on save saying that the field is invalid, although the default value is a seemingly selected. The only way to get past the error is to select another value, then go back and select the default value.
However, if used in a matrix, and the sub elements are inline, it seems you only have to re-select one place in order to be able to save. However, if not inline, you will have to change each element.
Steps to reproduce
Expected behavior
The default value of the new dropdown(s), as shown in the UI, should be saved.
Actual behavior
An error is thrown, saying that the new dropdown field(s) are invalid.
Craft CMS version
5.0.0
PHP version
8.2.16
Operating system and version
MacOS 14
Database type and version
Image driver and version
GD 8.2.16
Installed plugins and versions
Blitz 5.0.0-beta.4
CKEditor 4.0.3
Feed Me 6.x-dev
Pexels 1.0.1
SEOmatic 5.0.0-beta.8
The text was updated successfully, but these errors were encountered: