You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
removeItem() does a check to remove the option too - if (!self.settings.persist && self.userOptions.hasOwnProperty(value))
However it doesn't take into account a very specific programmatic setup - adding items to options and selections as user created, but not persisting when removed, also allowing duplicates (see Additional context).
In this scenario, I add additional items that are not part of the "normal allowed selection" programmatically, but when removing these additional values, it removes all duplicates, not just the clicked item because of a recursive loop of removeItem() -> removeOption() -> removeItem()...
Expected behavior
Regardless of if an item is user created or not, removing it should remove just that single item and no other items. If the item removed was a duplicate, it's option should stay present as it's still present as a selected item.
I realize I'm adding the option as "created" manually, and then turning off the create option, and this is the root cause of my issue, however there is a valid reason for this.
I am loading content into multiple fields, generated by user maintained formula (producing delimited strings). It is important for us to show all values the user configured in the formulas - valid or not - and alert the user on form submission of the "bad values".
I also need to prevent them manually entering any additional values that are not part of the options list - all while allowing duplicates. This is why create is disabled at the end.
My workaround is to adjust the condition in the description to: if ((!self.settings.persist && self.userOptions.hasOwnProperty(value)) && (!self.settings.duplicates || self.items.indexOf(value) == -1))
The text was updated successfully, but these errors were encountered:
Bug description
removeItem()
does a check to remove the option too -if (!self.settings.persist && self.userOptions.hasOwnProperty(value))
However it doesn't take into account a very specific programmatic setup - adding items to options and selections as user created, but not persisting when removed, also allowing duplicates (see Additional context).
In this scenario, I add additional items that are not part of the "normal allowed selection" programmatically, but when removing these additional values, it removes all duplicates, not just the clicked item because of a recursive loop of
removeItem() -> removeOption() -> removeItem()
...Expected behavior
Regardless of if an item is user created or not, removing it should remove just that single item and no other items. If the item removed was a duplicate, it's option should stay present as it's still present as a selected item.
Steps to reproduce
JS Fiddle: https://jsfiddle.net/stigmund/wg8po1yt/19/
great
tags.Additional context
I realize I'm adding the option as "created" manually, and then turning off the create option, and this is the root cause of my issue, however there is a valid reason for this.
I am loading content into multiple fields, generated by user maintained formula (producing delimited strings). It is important for us to show all values the user configured in the formulas - valid or not - and alert the user on form submission of the "bad values".
I also need to prevent them manually entering any additional values that are not part of the options list - all while allowing duplicates. This is why
create
is disabled at the end.My workaround is to adjust the condition in the description to:
if ((!self.settings.persist && self.userOptions.hasOwnProperty(value)) && (!self.settings.duplicates || self.items.indexOf(value) == -1))
The text was updated successfully, but these errors were encountered: