Skip to content

Common_Functions_AllWidgets

Methods

getContainerIndex() → {number}

Returns the index of the container of the widget. This may be the index of a column if the widget is in an array, or the index of a tab if the widget is in a tab panel.

Returns: number

getElement() → {Object}

Returns the HTML object of a widget.

Returns: Object

getLabel() → {string}

Returns the label of a widget (if it has one).

Returns: string

getListOfMyVariables() → {Array.}

Returns the list of variables of a widget.

Returns: Array.

getMissingVariableMessage() → {string}

Returns the message which is displayed when a mandatory widget variable is missing.

Returns: string

getName() → {string}

Returns the ID of the widget as a string.

Returns: string

getParent() → {object}

Returns the parent widget of a widget.

Returns: object

getTooltip() → {string}

Returns the tooltip text of the widget.

Returns: string

getValidationVariableMessage() → {string}

Returns the message which is displayed when a validation rule is not met.

Returns: string

getValue() → {string}

Returns the value of a widget on the current web page (e.g. text input).

Returns: Value of the variable Type: string

getVariableValue(varName) → {string}

Returns the value of a given variable of the widget.

Parameters:

Name Type Description
varName string Variable name

Returns: string

insertAbove(newWidget)

Allows you to insert above widgetID, the new widget created thanks to new RMP_xxx() function.

Parameters:

Name Type Description
newWidget Object the new widget

insertAfter(newWidget)

Allows you to insert on the left of widgetID, the new widget created thanks to new RMP_xxx() function.

Parameters:

Name Type Description
newWidget Object the new widget

insertBefore(newWidget)

Allows you to insert on the right of widgetID, the new widget created thanks to new RMP_xxx() function.

Parameters:

Name Type Description
newWidget Object the new widget

insertBelow(newWidget)

Allows you to insert bellow widgetID, the new widget created thanks to new RMP_xxx() function.

Parameters:

Name Type Description
newWidget Object the new widget

isActive() → {boolean}

Returns true if the widget is active, otherwise false. Be aware that this method does not return the value of the Editable option as it was defined in the WebModeler, since this value can change at runtime with setActive.

Returns: boolean

isEmptyVariable(varName) → {boolean}

Returns true if the given variable is empty, otherwise false.

Parameters:

Name Type Description
varName string Variable name

Returns: boolean

isEnabled() → {boolean}

Returns true if the widget is active, otherwise false (same as isActive). Be aware that this method does not return the value of the Editable option as it was defined in the WebModeler, since this value can change at runtime with setEnabled.

Returns: boolean

isIndexed() → {boolean}

Returns true if the widget variable is an array, otherwise false.

Returns: boolean

isIndexedVariable(varName) → {boolean}

Returns true if the given variable is an array, otherwise false.

Parameters:

Name Type Description
varName string Variable name

Returns: boolean

isRequired() → {boolean}

Returns true if the widget variable is required, otherwise false.

Returns: boolean

isValid() → {boolean}

Returns true if the widget variable is valid, otherwise false.

Returns: boolean

isValidVariable(varName) → {boolean}

Returns true if the given variable is valid, otherwise false.

Parameters:

Name Type Description
varName string Variable name

Returns: boolean

isVisible() → {boolean}

Returns true if the widget is visible, otherwise false.

Returns: boolean

moveAfter(insertedWidget)

Allows you to move inserted widget after (on the right) widgetID.

Parameters:

Name Type Description
insertedWidget Object the inserted widget

moveBefore(insertedWidget)

Allows you to move inserted widget before (on the left) widgetID.

Parameters:

Name Type Description
insertedWidget Object the inserted widget

remove(insertedWidget)

Allows you to remove insertedWidget.

Parameters:

Name Type Description
insertedWidget Object the inserted widget

setActive(active)

Sets the widget as active (true) or inactive (false).

Parameters:

Name Type Description
active boolean true: active, false: inactive

setActiveRule(condCallback, listenedVariablesopt, defaultValueopt)

Executes the condCallback script and sets the active state of the widget according to the execution result.

Parameters:

Name Type Attributes Default Description
condCallback module:Common_Functions_AllWidgets~callbackCondition Callback function which handles the active state condition
listenedVariables Array. [] Variables that should be replaced by their values inside the condCallback function
defaultValue boolean true Default value of the widget's active state

setEnabled(boolean)

Sets the widget as active (true) or inactive (false).

Parameters:

Name Type Description
active boolean true: active, false: inactive

setLabel(text)

Sets the label of a widget (except for HTML, image, array, and static text widgets which do not have a label field).

Parameters:

Name Type Description
text string Label

setMissingVariableMessage(msg)

Sets the message which is displayed when a mandatory widget variable is missing.

Parameters:

Name Type Description
msg string Missing variable message

setRequired(required)

Sets the mandatory status of the widget variable.

Parameters:

Name Type Description
required boolean true: required, false: optional

setRequiredRule(condCallback, listenedVariablesopt, defaultValueopt)

Executes the condCallback script and sets the required state of the widget according to the execution result.

Parameters:

Name Type Attributes Default Description
condCallback module:Common_Functions_AllWidgets~callbackCondition Callback function that handles the required condition
listenedVariables Array. [] Variables that should be replaced by their values inside the condCallback function
defaultValue boolean true Default value of the widget's required state

setTooltip(tooltip)

Sets the tooltip text of a widget.

Parameters:

Name Type Description
tooltip string Tooltip text value

setValidationVariableMessage(msg)

Sets the message which is displayed when a validation rule is not met.

Parameters:

Name Type Description
msg string Message to display

setValideRule(condCallback, listenedVariablesopt, defaultValueopt)

Executes the condCallback script and sets the valid state of the widget according to the execution result.

Parameters:

Name Type Attributes Default Description
condCallback module:Common_Functions_AllWidgets~callbackCondition Callback function that handles the valid condition
listenedVariables Array. [] Variables that should be replaced by their values inside the condCallback function
defaultValue boolean true Default value of the widget's valid state

setValue(value)

Sets the value of the widget variable. This does not work for list widgets (list, check box list, radio button list), where you should use widgetID.setSelectedValue instead.

Parameters:

Name Type Description
value string Value to set

setVariableValue(varName, value)

Sets the value of a given variable of the widget.

Parameters:

Name Type Description
varName string Variable name
value string Variable value

setVisible(visible)

Sets the widget as visible (true) or invisible (false).

Parameters:

Name Type Description
visible boolean true: visible, false: invisible

setVisibleRule(condCallback, listenedVariablesopt, defaultValueopt)

Executes the condCallback script and sets the visible state of the widget according to the execution result.

Parameters:

Name Type Attributes Default Description
condCallback module:Common_Functions_AllWidgets~callbackCondition Callback function that handles the visible state condition
listenedVariables Array. [] Variables that should be replaced by their values inside the condCallback function
defaultValue boolean true Default value of the widget's visible state

Type Definitions

callbackCondition() → {boolean}

Callback function to handle a rule condition of a widget (active, visible, valid, required).

Returns:true if the widget is visible/active/valid/required, otherwise false. Type: boolean