Clear forms or access data in elements inside Listviews

Just if anyone stumbles with this problem, this is the solution that I found.

As the form is filled with the default value set-up from a variable, if I change the value in the input, this new value stays set in this input. I had implemented the option to delete a row but the next row that took the deleted row's place had its input values replaced with the deleted row's values.

What I did was:

  • There is a variable that mimics the listView values. So listView values are read-only.

  • On each input of listView: add scripts that runs "on change" to edit the source variable example: rates.setIn([ri[0], "variable", i, "variable1"], variable1Input.value)

  • In this same script, I add rateForm.clear, which runs only for the row which you are editing. This clears the input hard-coded value and it is filled with the same value that you just updated, just not hard-coded.

  • As the value in the input isn't hard-coded, when you delete a row, reset values or whatever; the inputs are filled with the values from the variable.

1 Like