pp108 : removeOption()

removeOption()


It removes an option from the Select and List controls.

Syntax

Script

optionObject = ControlID.removeOption([vOption,] bTransaction)


Return Value


Returns the option object that is removed from the Select or List control. The returned option contains the xml property, which contains its XML data node and the businessObject property which returns the business object to which the control is bound.

Parameters

Parameter

Description

vOption

Variant that denotes the option object or the index of the option to be removed.

bTransaction

A boolean value that indicates whether the object needs to be updated for transaction. If true, then the data associated with the Select and List controls is updated. The default value is true.


Remarks


If the index of the option or the option is not specified, then the current selected items from the Select or List control will be removed.

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 example demonstrates the usage of the method to remove the options by passing the index of the option to be removed:

// Removes the option whose index is '4' 
SelectBoxID.removeOption(4, true);

The following example demonstrates the usage of the method to remove an option by passing the option object:

// Removes the specified option in the selectbox. 
var option = {value:1,description:"ItemA"};
SelectBoxID.removeOption(option,true);

Applies to


Select, List

Related reference

addOption()
removeOptions()
addOptions()
getSelectedOptions()
getAllOptions()