I am working on some K2 solutions that rely heavily on SmartForms. When building these forms, I usually find that I need to reuse some parts such as logic. What I do now is that I create a button, and place all of that logic 'behind' that button. Next I hide that button. On the locations that I want to implement that logic, I connect to that hidden button.
Basically, what I need is what is referred to as a function in other languages. What would be the best way to do this in SmartForms.