Hi, we have a page with multiple input elements and a “Calculator” Form Modal to build any number.
How it works: We click on any input element, it opens the modal, the user builds the number (stored variable).
Now the challenge for us is to update the latest clicked input element value, with the stored variable on validation, how to manage that on a generic level?
We added a JS in the validation workflow of that calculator to manage the updates, but it is heavy and does not work all the time correctly. We don’t want to use a tree / switch logic as we will use this modal across all the app to update inputs.
After this setup, what you can do is do something like this:
On click open the modal, set the Current CHF input to be the current clicked input’s identifier
Edit the amount of the CHF state as follows by doing a partial update of the Object (bind the Current CHF input to the Path) and set your value to whatever you do with the modal:
Thanks for the tip. On the page I have 20 inputs and would like to use that calculator modal across many other pages. So if I understand well, I have to add all the inputs (identifiers) of a page in the object?