PromptControl

Common interface to all prompt controls.

See Supported controls for a list of controls that support this interface.

Extends

Members

(readonly) element :HTMLElement

The control's HTML element. No assumptions should be made about the element's type (nodeName) or contents.

Type:
  • HTMLElement
Inherited From

(readonly) name :String

The control's authored name.

Type:
  • String
Inherited From

(readonly) parameter :String

The control's parameter name.

Type:
  • String

Methods

addValues(aValues)

Add an array of values to a control. If the control does not support multiple values, only the first one provided is used.

Parameters:
NameTypeDescription
aValuesArray.<ParameterValue> | Array.<ParameterRangeValue>

The values.

clearValues()

Clear (or deselect) all values for this control. For a text prompt, the text is set to empty. For a value prompt, all the selections are removed.

getDisplay() → {Boolean}

The display state of the control.

Inherited From
Returns:

true if the control is displayed and false if the control is not displayed.

Type: 
Boolean

getValues(bAllOptionsopt) → {Array.<ParameterValue>|Array.<ParameterRangeValue>}

The current values for the control.

Parameters:
NameTypeAttributesDefaultDescription
bAllOptionsBoolean<optional>
false

This optional parameter is applicable only to value prompts. The parameter specifies whether to retrieve all values or only selected values. If the parameter is true, then all options are returned. If the parameter is false or missing, then only the selected options are returned. The default value of this parameter is false.

Returns:

An array of the current values.

Type: 
Array.<ParameterValue> | Array.<ParameterRangeValue>

getVisible() → {Boolean}

The visibility state of the control.

Inherited From
Returns:

true if the control is visible and false if the control is hidden.

Type: 
Boolean

setDisplay(bDisplay)

Set the display of the control.

WARNING:
If the control is authored to be initially not displayed using the property "Box type" with a value of "None", this is treated like a conditional render so the report output will not contain the control. Use a "Box type" of "None-Block" or "None-Inline" instead.

Parameters:
NameTypeDescription
bDisplayBoolean

Pass true to display and false to not display the control.

Inherited From

setValidator(fnValidationCallback)

Changes the default validation function for a control to one defined by the user. When the specified function returns false, the UI element associated with the control indicates that a validation error occurred. When used in a multi-select control, the Insert button is disabled.

Parameters:
NameTypeDescription
fnValidationCallbackPromptControl~ValidationCallbackFunction

A user-defined function that takes the user input as a parameter and returns a Boolean value.

Example

Set a custom validator on a prompt textbox

oPage.getControlByName( "txtPhoneNumber" ).setValidator( fnPhoneNumberValidator );

setValues(aValues)

Resets the control and adds an array of values to a control. If the control doesn't support multiple values, only the first value provided is used. This is a convenience method that issues consecutive calls to clearValues() and addValues(). If the control does not support multiple values, only the first one provided is used.

Parameters:
NameTypeDescription
aValuesArray.<ParameterValue> | Array.<ParameterRangeValue>

The values.

setVisible(bVisible)

Set the visibility of the control.

Parameters:
NameTypeDescription
bVisibleBoolean

Pass true to show and false to hide the control.

Inherited From

toggleDisplay()

Toggle the display of the control. See getDisplay and setDisplay for details.

Inherited From

toggleVisibility()

Toggle the visibility of the control. See getVisible and setVisible for details.

Type Definitions

ValidationCallbackFunction(aValues) → {Boolean}

A callback function used to validate prompt controls. The function is passed an array of the "values" portion of ParameterValue or ParameterRangeValue.

Parameters:
NameTypeDescription
aValuesArray

An array of the values.

Returns:

true if all values are valid or false if any of the values are invalid.

Type: 
Boolean
Example

A callback function for validating phone numbers

fnPhoneNumberValidator( aValues ) => !aValues.some(value => !value.use.match( /^\(\d\d\d\) \d\d\d\-\d\d\d\d$/ ));