pp108 : removeOptions()

removeOptions()


It removes options from the Select and List controls.

Syntax

Script

optionsCollection = ControlID.removeOptions([vOptions,] bTransaction)


Return Value


Returns a collection of option objects that are removed from the Select and List controls. The returned options contain the xml property, which contains their XML data node and the reference to the business object to which the control is bound.

Parameters

Parameter

Description

vOptions

Variant that denotes the collection of objects. This collection can contain either the options returned by the getSelectedOptions() method or the indexes of options to be removed.

bTransaction

Boolean which denotes whether the object has to be updated for transaction. If true, then the data associated with the Select or List control will be updated. The default value is true .


Remarks


If the indexes array is not specified, then the current selected items from the Select or List control will be removed.

The optionsCollection contains option objects. The following table lists the properties of an option object.

value

A string that is used internally for transactions. You cannot access the value.

description

A string that is accessible to you.



If the description property is not provided for the option object, then the value property is taken as its description.

Sample Codes

The following code snippet shows the usage of the method to remove the options by passing the indexes of the options:

//Create an array for the indexes of option objects
var indexArray = new Array();
indexArray[0] = 2;
indexArray[1] = 3;
SelectBoxID.removeOptions(indexArray, true);

The following code snippet shows the usage of the method to remove the options by passing the option:

//Code to remove the selected options in the selectbox
SelectBoxID.removeOptions(SelectBoxID.getSelectedOptions(),true);

Applies to


Select, List

Related reference

removeOption()
addOption()
addOptions()
getSelectedOptions()
getAllOptions()