Initial value of the multiselect input dropdown is an array variable (SelectedPost.Instructions)
I had a more complex workflow for the dropdown but to narrow down this problem now I only have one step (change the variable value with what’s in the “multiselect input - current selection”):
The problem I am facing is when I try to add a new one-time tag, and then I remove that tag, I start seeing duplicates of it in the drop down. How to stop the duplicates from happening?
can you try using a little javascript here. basically, you’d keep their input as an option BUT remove it from the currently selected items only.
// Access the global variables
const testOptions = [the variable that holds your options];
const testSelections = [this references the multiselects current selection variable];
// Create a new array to store the updated test options
const updatedTestOptions = [...testOptions];
// Iterate through test selections
testSelections.forEach(selection => {
// Check if the selection is not in test options
const isMissing = !testOptions.some(option => option.value === selection);
// If the selection is missing, add it to the updated test options
if (isMissing) {
updatedTestOptions.push({ key: selection, value: selection });
}
});
// Return the updated test options
return updatedTestOptions;
When you try to delete “add something” after adding it in (not clearing the whole thing, but just the new tag), do you see a duplicate in the dropdown? That’s the problem I am facing.
Could I have that first code you put in step 1 for “TEST selections”? I will try using that!
I’m assuming the code in step 2 is already above. I will try to repeat your whole set up haha