validation error in expandable sections

validation error in expandable sections

I am trying to make a survey with questions that must add up to 100% and cannot be more of less. I have figured out how to do the more than 100% but on the less there seems to be an error.
I am also using a widget (expandable section) and it does recognize that the numbers do not add up to 100 and has a validation error. However, when i click save, all my other answers go to 0. I want my original answers, and the ability to just adjust the value which is under 100% and save over it.
I have attached part of my logic below

First of this should be in the technical section.

second, I have no clue what you want to achieve exactly.
The flow is not very, well, nice.
But besides that.

how is the save-button, a submit or ajax-submit.
I don't see any ajax-refresh after in input_focusfirstinvalid.

Why not store the survey in a temp-table anyways, since you want to have them in the end?
This will make your life easier, and you simply can do a sum/count whatever in a query.