Scriptable Reports

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:
Name Type Description
aValues Array.<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:
Name Type Attributes Default Description
bAllOptions Boolean <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:
Name Type Description
bDisplay Boolean 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:
Name Type Description
fnValidationCallback PromptControl~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:
Name Type Description
aValues Array.<ParameterValue> | Array.<ParameterRangeValue> The values.

setVisible(bVisible)

Set the visibility of the control.
Parameters:
Name Type Description
bVisible Boolean 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.
Inherited From:

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:
Name Type Description
aValues Array 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

function fnPhoneNumberValidator( aValues )
{
	for ( var i = 0; i < aValues.length; i++ )
	{
		if ( !aValues[i].use.match( /^\(\d\d\d\) \d\d\d\-\d\d\d\d$/ ) )
		{
			return false;
		}
	}
	return aValues.length > 0;
}