Call function when button is clicked

Newbie here.

I have defined a custom function which performs calculations based on the user input. I would like to show the results back to the user when they press the "Submit" button. How can I achieve this? I could not see a way to define an action which would call the custom function.

your suggestions would be really appreciated.