When you want your code to act on GE field value changes, but are not writing a GE Plug-In, you need to register for notifications when a field value changes. (If you are writing a GE plugin, you can simply override the set() method.)
There is an example in the Layout Control template JavaScript. |
Since you will call this function every time any field value on the GE changes, you'll need some extra logic inside to call the correct function for each field. For most cases, you probably won't want to do anything at all. We generally handle this by switching on the lower-cased value of the field name.
For example, if we wanted to do something each time a Person GE's FirstName field changed, we would define a function like this:
function _geFieldValueChanged(paramData, eventData) { try { switch(eventData.field.toLowerCase()) { case "firstname": // call a function to do on-first-name-changed logic break; default: // for most fields, do nothing break; } } catch (ex) { Aptify.framework.exceptionManager.publish(ex); } } |
Call the GE's registerNotifications() function, providing the GEFieldValueChanged notification and your callback function:
ge.registerNotification({ event: Aptify.framework.configuration.eventDefinitions.GEFieldValueChanged, callBack: _geFieldValueChanged }); |
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.