I’m basically thinking out load here, but for a given form, we might have separate methods for onShow, onRecordSelection, onDataChange, etc., and I would imagine the amount of code in each method isn’t that much, so it might help from an organization standpoint to have a single method in each form dedicated to processing these events. Maybe something like:
var eventName = application.getMethodTriggerEventName();
var elementName = application.getMethodTriggerElementName();
if (eventName == 'onShow')
{
// do stuff
}
else if (eventName == 'onDataChange')
{
if (elementName == 'fld_first_name')
{
// do more stuff
}
}
:
:
:
I used to use the flexibility of Javascript to combine lots of functions in a single method. But coming back a year or two later you have to try to remember which mega-Method holds the function you are looking for - and then scroll down through a couple of screens of ‘if’ and ‘switch’ groups.
Now seperate functions and use Method name to describe whats happening - ie: onShow_focusSurname or onDataCh_Surname_checkDups. Saves a lot of time later.