Remove option from multicombo field

I have figured out how to add new options to a multicombo field, but I have not figured out how to remove or replace an item. I have tried $$(‘fieldName’).getPopup().getList().remove(option.id) … followed by $$(‘fieldName’).getPopup().getList().add({…option data…}). That did not work. I ended up with two separate options in the list, with the same username. This makes it impossible for the user to tell which is which.

I need to replace the options because the hidden values of an option contain Department and Facility information which may have changed since the most recent submission.

Please see my example form: https://webix.com/snippet/ca311176

I have indicated the area where I need help with // NEEDS HELP //

Thank you!

Remove itself works fine: https://webix.com/snippet/e587ef9c
The main issue in the remove(toReplace.id). Here toReplace array is handled like an object. By the way, debug version of the library throws a corresponding error.
Please use remove(toReplace[0].id) instead.

There are also three issues to correct:

  1. As the item will be deleted from the list but not from the value of the multicombo, you need also check and remove it, if necessary.

  2. Please note that the comma is used as a default separator in multicombo.
    Thus, data items with commas won’t be handled properly until you set a custom separator: https://webix.com/snippet/d1a4a203
    Please pay attention to the enhanced method of creating/setting initial options.

  3. As you’re using a full-featured form, a simple clear() method will be enough to clear all inputs that have a name.

Here’s the original snippet with the mentioned corrections: https://webix.com/snippet/4602a86b

Thanks! That worked beautifully.