How can I get the value an Input had before it changed?
Application Type

Hi there.

I have a screen with a list. Each item inside this list contains an Input widget where the user can enter a number. These numbers have to be added up as they are entered, to check if the sum of all of the numbers the user has entered equals a certain number (in this case, let's say that number is 10).

I thought I could achieve this by using the Inputs' OnChange event. I would add the current value of the Input to a local variable which holds the total sum. But what if the user types a number, then deletes it and types in another number? The new number would be added to the total without first subtracting the old one from the total. And I don't know how to fix this problem.

If anyone has any ideas on how to solve this, I'd really appreciate it :)


Instead of using the inputs on each OnChange, you can try to call the OnChange without inputs and inside of the action, use a ForEach to iterate each input and sum the values. This way it doesn't matter if you add or delete, the total will always be the sum of what is on the inputs at the moment.

Feel free to ask if you have any question about this.

Best Regards

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.