If you have a comment on this topic, contact Aptify Documentation. If you want to return to the Aptify Community Site, please click here.

Get the GE Object Behind a Form Template Layout Control

When working in the code of a form template layout control, you may need access to the GE being displayed by the form template.

Unlike the Aptify .NET API, the Aptify JavaScript API does not require the developer to manage the communication between the GE and the UI. If you change a GE field value, that value will change in the UI, and vice versa.

This can make it very tempting to implement business logic in a form template layout control. Resist this temptation. Any logic that is not directly dealing with the UI is business logic and should be implemented as such in a client-side GE plugin.

Step-by-step guide

  1. Retrieving the GE from the main layout control function:
    Layout control objects have a function called getGEObject(). Any time you have access to the layout control object, you can simply call getGEObject() on it. If the GE has been loaded, it will be returned.

    Directly reference the "this" variable
    var _ge = this.getGEObject(); 
    Reference an aliased "this" variable
    var _ftl = this;
    var _ge = _ftl.getGEObject();


  2. Retrieving the GE from eventData:
    Overrideable events on the form template layout receive an object. This object almost always includes a formTemplateLayout property that is the layout control itself, and may also include a geObject property. If the geObject property exists, you can use it directly. Otherwise, you can call getGEObject() on the formTemplateLayout property.

    Reference the geObject property in afterLoad
    // afterLoad() receives an object with the geObject property
    // This function is registered as overriding afterLoad()
    function _afterLoad(eventData) {
    	var _ge = eventData.geObject;
    	
    	// do work with the GE
    }
    Reference the GE through the formTemplateLayout property
    // beforeLoad() receives an object with a formTemplateLayout property
    // This function is registered as overriding beforeLoad()
    function _beforeLoad(eventData) {
    	var _ftl = eventData.formTemplateLayout;
    	var _ge = _ftl.getGEObject();
    }

Copyright © 2014-2017 Aptify - Confidential and Proprietary