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 displays first option by default, but behaves as if empty #562

Closed
verythorough opened this issue Aug 29, 2017 · 3 comments · Fixed by #673
Closed

Select widget displays first option by default, but behaves as if empty #562

verythorough opened this issue Aug 29, 2017 · 3 comments · Fixed by #673

Comments

@verythorough
Copy link
Contributor

verythorough commented Aug 29, 2017

- Do you want to request a feature or report a bug?
bug

- What is the current behavior?
When you start a new item in a collection, select widgets (without a set default - haven't tried with a default yet) will display the first option, as if they are selected. However, when you try to save, the field behaves as if it's blank: saving is blocked, and the label turns red.

- If the current behavior is a bug, please provide the steps to reproduce.
Make a new Kitchen Sink item in the CMS demo site: https://cms-demo.netlify.com/#/collections/kitchenSink/entries/new

Note that the Select field appears to be set to the first choice, "a". Click save, watch it fail, and see the red label for the select entry:
filledselect

Select any option (inlcuding "a"), and it will save properly.

- What is the expected behavior?
Normally, I would expect the dropdowns to be blank in their initial state. If not, they should actually be set to the option they display.

- Please mention your node.js, and operating system version.
Current Chrome on Windows 10, CMS 0.4.6

@JacobMillward
Copy link

If you add a default option with the same value as the first select choice, it works around it. In my case, my select only had one option though.

@moshie
Copy link

moshie commented May 9, 2018

What happens in the event you want an empty option and a different label simply setting:

options:
  - { label: "Not featured", value: "" }
  - { label: "Featured", value: "featured" }

This shows the extra hidden option and the empty one instead of overwriting it.

@tech4him1
Copy link
Contributor

@moshie Feel free to open a new issue and request support for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants