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

Set absent select option. #110

Open
LastRide opened this issue Oct 31, 2017 · 1 comment
Open

Set absent select option. #110

LastRide opened this issue Oct 31, 2017 · 1 comment

Comments

@LastRide
Copy link

LastRide commented Oct 31, 2017

Garlic.js could set value that not exists for <select> tag.

The bug is here - https://github.com/guillaumepotier/Garlic.js/blob/master/garlic.js#L191.

Case:

  1. Create form with
<select>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
</select>
  1. Choose "1" option and submit form.
  2. Delete <option> with value "1" from form.
  3. Open form. You will see that <select> would be empty. Garlic.js would set "1" val to <select>.

And the bug is in the detectConflict() function. https://github.com/guillaumepotier/Garlic.js/blob/master/garlic.js#L221

It ignores first <option> value. If selected option would be the first and it's value would not be equals to option value - garlic would ignore this and set unexisting value to <select>

@LastRide
Copy link
Author

LastRide commented Jul 3, 2018

Up :)

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

1 participant