Skip to content
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

Select widget becomes empty when selecting an option with value 0 #6515

Closed
lucadalli opened this issue Jul 17, 2022 · 2 comments · Fixed by #7254
Closed

Select widget becomes empty when selecting an option with value 0 #6515

lucadalli opened this issue Jul 17, 2022 · 2 comments · Fixed by #7254
Assignees
Labels
area: extensions/widgets good first issue type: bug code to address defects in shipped code

Comments

@lucadalli
Copy link

Describe the bug
The select widget allows true numbers (not numeric strings) to be stored by passing an array of { label: string, value: number } objects as the options parameter.
However, when an option with a value of 0 is selected in the UI, the field becomes empty, likely due to some bug related to input validation. Since the field becomes empty, if the select is required, the entry cannot be saved, otherwise the value saves as null.

To Reproduce
Create a select widget and add an option which has any label and a value of 0.
Attempt to select that option via the UI

Expected behavior
The option with a value of 0 is selected and its label is displayed

Applicable Versions:

  • Netlify CMS version: 2.10.192
@lucadalli lucadalli added the type: bug code to address defects in shipped code label Jul 17, 2022
@itssachinkr
Copy link

i would like to work on this issue. please assign it to me.

@imangd
Copy link
Contributor

imangd commented Jun 13, 2024

Hi @martinjagodic , if this issue is still open for contribution, I'd like to work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: extensions/widgets good first issue type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants