-
Notifications
You must be signed in to change notification settings - Fork 642
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
[4.x]: Can't omit value for optional Dropdown field in 4.9.0 #14912
Comments
Hi, thanks for reaching out! |
We're saving the element via fixtures. I have seen this error in multiple, independent setups of ours that use a dropdown filled via fixtures. |
@boboldehampsink Can you update to the latest 4.x release and see if that fixes it? |
@brandonkelly oops I wrote 4.6.0 but I meant 4.9.0 - this IS on the latest version |
Can you send us a project where this is happening, so we can reproduce? [email protected] |
I'm running into this issue too. As it happens I was working on a CLI-based sync command, that also does a call to So very narrowly, the reason why it did work for me on <4.9.0 and not in >=4.9.0 is this change: 4.8.11...4.9.0#diff-9490c3633b0153e774e90992895f3d5ae500ce1f657afd0da3eb2950400b4498. And since fixtures are usually run from a CLI-context as well, I suspect this is also why @boboldehampsink ran into this issue and reported it. Side-note: there is a bit more to it for my project I suspect, since I get this validation message also on existing entries when saving them through the CMS. They don't get touched often, and when they do the person managing the content probably fixes the validation message by selecting a value and never reported it to us. Edit: I "fixed" it by added an empty value as the default option to the field. That works fine enough for our project. |
The behavior has changed a bit over time (especially in 4.5.x), but you cannot save a dropdown field without one of its options being selected as a value while there is no default value set. Context here with lots of linked related issues: #13540 If you want to save an entry without setting an option, add an empty value as the default option to the field, and that will be used as the default when there is none set. This is reproducible (and expected behavior) from the control panel as well. To me, the odd part is that you mentioned it was working fine in 4.8.9 @studio-stomp, which I would assume had the same behavior. I am going to go ahead and close this as intended behavior, but if there are additional details, follow up here again, and we can re-open if necessary. |
What happened?
Description
In 4.9.0 I get the following error:
I'm not setting any value to this field and it is not required. It doesn't have a default either. This worked in 4.5.x
Steps to reproduce
Expected behavior
No validation whatsoever
Actual behavior
Validation: "xxx is invalid"
Craft CMS version
4.9.0
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: