JavaScript

{dialog.object}getPointer Method

Syntax

{dialog.object}.getPointer(variableName [, part]);

Arguments

variableNamestring

The name of the control in the UX Component

partstring

The control part. Can be one of the following:

Part
Description
'label'

Get a pointer to the label for the control.

'container'

Get a pointer to the container for the control.

Returns

resultobjectboolean

Returns the HTML DOM element for the requested control. If no element exists, getPointer() returns false.

Description

Get a pointer to the DOM element for a UX component control.

Discussion

Get a pointer to the DOM element for a control, such as a text box, button, label, etc. so that you can manipulate the DOM element. Prefer to use this method over document.getElementById.

If the HTML element doesn't exist, getPointer() will return false. You should always check the returned value of the getPointer() method before using the object. This can be done by wrapping your code in an if block as shown in the example.

//Get a pointer to the container called 'CONTAINER_1'
var containerEle = {dialog.object}.getPointer('CONTAINER_1');

if (containerEle) {
    //Object exists
}

//Get a pointer to the button 'BUTTON_1'
var buttonEle = {dialog.object}.getPointer('BUTTON_1');

if (buttonEle) {
    //Object exists
}

// REPEATING SECTIONS

//Get the instance number for row 3
var row = {dialog.object}._repeatingSectionLogicalToPhysicalRow('SECTION_1',3);

//Get a pointer to text box 'TEXT_1' in row 3 of a Repeating Section
var textEle = {dialog.object}.getPointer('TEXT_1_A5INSTANCE'+row);

if (textEle) {
    //Object exists
}

Example: Getting a Pointer to a Control's Label or Container

{dialog.object}.getPointer() can be used to get a pointer to a control's label or container. This allows you to do dynamically change a label or re-style a container at runtime:

//Change the label for the FIRSTNAME field
//Get a pointer for the 'FIRSTNAME' field's label and set the text
var ele = {dialog.object}.getPointer('FIRSTNAME','label');
if (ele) {
    ele.textContent = 'New label for Firstname';
}

//put a blue border around the FIRSTNAME field
var ele = {dialog.object}.getPointer('FIRSTNAME','container');
if (ele) {
    ele.style.border = 'solid 1px blue';
}

See Also