Element args in an event?

I have a custom form that can be called from two places currently. I have each caller form being stored in an onClicked event but can't seem to get element to come over what I am trying to do another event. Is element only used in the init method of a form or can I use that caller method in events aswell?

  • No, there is no magic that would add a variable called 'element' to your static method used as an event handler. The 'element' variable is defined in forms (and can be also used in form extensions).

    The variables you can use in static methods are defined by method parameters, but note that the first parameter of an event handler is usually the caller object. If you consume a form event, you get the form, i.e. the same thing you would get from 'element' if you worked inside the form. If you consume a form control event, you get the control and you can easily get a from reference from there.