acf-color-palette
acf-color-palette copied to clipboard
Console Error message when "Choice" attribute is not setted
Hi ! Thanks for your contribution and your plugin, i use it for many projects. So I open an issue because I created a Color-palette for test in local environment and I've forgot to set default choice like this :
#f00 : Red rgb(0,255,0) : Green rgba(0, 0, 255, 1) : Blue
I saved the custom field and I was editing an article to use it, and I had a console error:
SyntaxError: "JSON.parse: unexpected character at line 1 column 1 of the JSON data" TypeError: n.palettes.map is not a function
So I think that it would be necessary to check the field "Choice" in ACF before the save to avoid this kind of errors.
Thanks for your work and your time.
Hi @be2ny, Thank you to point out this problem. It's a bit stupid but I didn't think to save the field without any value :sweat_smile:
We can resolve the problem in two steps :
- Throw an error into ACF page if the field is required;
- Display a warning message into post editing page if the field hasn't any value.
I hope you will appreciate this solution. I will try to fix this issue during the week.
What about a global setting for a "default" color?