Clear values from ListView components

I'm creating an app involving ListView, and I'm a beginner in this area. I'm trying to reset all input field values when the user clicks the Clear button. Currently, I've set an array of indices [0,1], but it only clears the first input field, textInput5[0]. Any suggestions on how to resolve this?

I think you will need to add an event handler for each of the values. So one for Value 1 and another one for Value 2 in the clear buttons event handlers.

1 Like

"@Haseeb1399, Thank you.
However, this approach may not be feasible, as users have the ability to add numerous new input fields at their discretion."

Put all input fields in a form and then you can clear each form in the list view using the length of the list view to run a a clear event handler for each form whereby each form is designated by it's index value (i)

1 Like

Hello, You can try this approach.

for (let i = 0; i <; i++) {
1 Like

From the position of your Clear button it looks like you are trying to clear the entire ListView.

If that's the case, you simply need to clear out whatever the ListView source data is. If it is a Variable like in the ListView example I referred you to in another thread (what used to be called Temp State Variables) use myVarible.setValue([]) to clear out the array. If you are using a query and the source then do myQuery.reset()

One key to working with ListView is that you do not alter the child components directly, only the user does that by entering/changing data. You only refer to and change the underlying source of the data, and the components will automagically respond that.

1 Like

Thank you.