Clear Fields chosen from MultiSelect

Hi !
The goal is to show a MultiSelect that is populated with all the fields within a form, Then use the value from the MultiSelect to loop through and clear those values.
Since they are stored as strings, my foreach isnt working. Any pointers would be amazing!

The Source of my multiSelect is
{{ Object.keys(form7.data) }}

What Ive tried so far
multiselect4.value.forEach(function (object) {object.clearValue()})

Hey @sergserg,

So just a quick question, is form7.clear(); not fir for your use case? Just trying to understand what is it that you want to achieve.

1 Like

form7.clear();
Would clear the entire form. The way I want it to work is that the user can choose what fields to clear with a multi select.

Hi @sergserg,

Currently, we don't have great support for this use case :disappointed: It is solvable, but we have a feature request in our backlog for better support

You can solve it by manually maintaining a list of components, as shown in the below example (components)

var components = {"textInput1": textInput1, "numberInput1": numberInput1, "phoneNumber1": phoneNumber1, "percent1": percent1}

multiselect1.value.map(x=>components[x].clearValue())

1 Like