Javascript to calculate certain fields (related to the neighbour-field)
Hello Community 🙂
we are a group of youth clubs, trying hard to generate a form, that calculates differnt kinds of expenditures.
In the first tab the youth facilities can choose per dropdown-list the kind of expenses ('KONTO,' 6 different kinds, like "hospitality", "repairs", "office material"...), and in the second tab a comment and in the third tab 'BETRAG' the amount of that kind of expanse.
In the image i have given names to the fields for better understanding.

Now we try to add all values of the same kind, --> all 'exp-amount'-fields, that have been picked the same kind of "exp-kind" in the second tab dropdown-lists.
For example: When a youth club adds three lines of expenditures of the kind 'Bewirtung' (hospitality), then the values of the corresponding fields "exp-amount" should be added together and the sum be displayed in the field "sum-xy", and so on...
So for example, the sum-field of "Summe Bewirtung" should have a JS which behaves something like:
{add together all exp-amount-fields, whose line-corresponding exp-kind-fields have the name / value = '4530 Bewirtung'}
Maybe for Javascript-Experts this is only a few-lines-Script, but i fear this is way too complicated for me (and i'm not totally new to JS...). I'm into this for about 1 week now, and whenever possible i scan the internet for approaches, but it doesn't work at all 😞
Maybe someone has a little idea or tipp how we could achieve this? I would be eternally thankful as this is getting me totally insane.
Thanks for reading and best wishes 🙂
tmo
