I need to implement a complicated form. For example, there are fields for summands, sum and percentage of each summand in that sum. Illustration:
Value1: 1 10%
Value2: 4 40%
Value3: 5 50%
Sum: 10 100%
The real life example is much more complicated. Everything is editable. So, I assume several scenarios:
- Editing a value updates percentages and sum.
- Editing the sum updates values according to their percentages.
- Editing a percentage updates all other percentages to be 100%, which itself updates all the values and sum.
I am currently trying to implement something like this using Backbone.js (just because I'm familiar with it), but the solution already looks over-engineered, and I am just in the beginning.
I wonder, is there any other approach I can look into? I'm not an FRP person, but probably functional/reactive approach can help somehow?
If there is a framework or library designed to solve such kind of problems, I would be happy to look into it.