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

Dropdown/checkbox field with duplicate values behave weird #4983

Closed
SayChi opened this issue Sep 24, 2019 · 1 comment
Closed

Dropdown/checkbox field with duplicate values behave weird #4983

SayChi opened this issue Sep 24, 2019 · 1 comment

Comments

@SayChi
Copy link

SayChi commented Sep 24, 2019

Description

When adding 2 or more options to a dropdown or checkbox field with the same value, the field starts to behave 'weird'. I'm assuming this is simply due to the post containing that value when saving, the db then saving that value and once the page is loaded again it's not sure what option was selected as it only has that value. But this makes for unexpected behaviours, thus I suggest it shouldn't be allowed to save such fields with duplicate option values.

Steps to reproduce

  1. Create new field, either dropdown or checkbox (possibly multi-select too? Haven't checked)
  2. Add option A with value a
  3. Add option B with value a
  4. Add field to some entry or global layout
  5. Select option A
  6. Save (and automatically reloads)
  7. Now both option will be selected in case of a checkbox field. In case of a dropdown field B will be selected (the last in the list as far as I can tell)

Additional info

  • Craft version: 3.3.0.1
  • PHP version: 7.1.32
  • Database driver & version: MySQL 5.5.64
  • Plugins & versions:
    Cloner | 1.0.3
    Control Panel Nav | 2.0.9
    Expanded Singles | 1.0.7
    Field Manager | 2.1.0
    SCSS | 1.0.0
    SuperSort | 3.0.1
@brandonkelly
Copy link
Member

Good point, I’ve just updated Dropdown/Radio Buttons/Checkboxes/Multi-select field validators to ensure all option labels & values are unique.

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

No branches or pull requests

2 participants