Function ? ... Perform ? ... Don't know what to call it?

I have a form field that accumulates several other form fields. I am using “on change” to update the fields.

But I need to create a function (?) that will let me add the current field to the accumulating field. It is only 2 lines of code, but do not want to cut and paste the 2 lines everywhere I need it.

In the old COBOL days, we did a PERFORM. I know there has to be a similar style in Wix, I just don’t know what to look for or call it. A very simple example would be appreciated.

TYIA …
Bobby