Update multi select field using javascript

Here is the setup.

I have two tables, let’s call them test and tester. Table test has a field named testers that is a connection to table tester, the cardinality being 1 test to multiple tester. In a form, I have the testers field generated as a multi select element, i believe you guys are using select2 for this.

Using a js i wrote in a page specific js, i updated the value of field testers using the code below.

$(testersFieldObj).val(['a','b','c']).trigger('change');

Code above assumes that the testers field select element is referenced by testersFieldObj, and the table tester has data with ids a, b, and c. Visually, you can see the field testers in the form is updated, tester’s a, b, and c are selected. But, when I save the form, it doesn’t get saved in the table test.

I’m honestly stuck and i’m not sure how to proceed.

sir @moe , i was hoping you had some insight regarding this “how do i”?

This has been asked a few times around here. The team is aware of this, I will check and get back to you as soon as possible. :grinning:

Thanks, hopefully we’ll be able to have a solution soon.