HTML_Select Class

This class provides the API for HTML selection input elements (select and select-one). Web browsers normally render select elements as list boxes and select-one elements as comboboxes. This class inherits the HTML_FormElement Class which inherits the HTML_Object Class. (See also HTML_CustomSelectList Class.)

Boolean HTML_Select.isMulti()

This function returns true if this selection element is a multi-selection (type select); otherwise it returns false (meaning that this element is of type select-one).

HTML_Option HTML_Select.optionAt(index)

Returns the option (HTML_Option Class) at position index in this selection element. (The indexing is 0-based.)

This is a convenience function equivalent to html_select_object.options().at(index).

HTML_Array HTML_Select.options()

This function returns an array (HTML_Array Class) of all the options (as HTML_Option Class objects) contained in this selection element.

listOfTexts HTML_Select.selectedTexts

This property provides a list of the texts of all options that are currently selected in the selection element.

Assigning a new list of texts to this property changes the selected options in the selection element so that all options whose text matches any of the ones listed will be selected and all other options in the element will not be selected. For example if the element has 4 options with the texts Red, Blue, Green and Black and the currently selected texts are Red and Green, then assigning a new list Blue, Black to this property will deselect the Red and Green entries and instead select the Blue and Black one.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

listOfValues HTML_Select.selectedValues

This property provides a list of the value attributes of all options that are currently selected in the selection element.

Assigning a new list of values to this property changes the selected options in the selection element so that all options whose value matches any of the ones listed will be selected and all other options in the element will not be selected.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

listOfNumbers HTML_Select.selectedIndexes

This property provides a list of the index of all options that are currently selected in the selection element.

Assigning a new list of indexes to this property changes the selected options in the selection element so that all options whose index matches any of the ones listed will be selected and all other options in the element will not be selected.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

listOfNumbers HTML_Select.selectedLabels

This property provides a list of the label of all options that are currently selected in the selection element.

This property does not allow assigning a new value to it, it is read only.

This is a synthetic property, see Synthetic Properties in Web Objects for more information.

HTML_Select.deselectByValues(values)

This function deselects the items of the selection element that have a value that is listed in the values parameter.

HTML_Select.deselectByTexts(texts)

This function deselects the items of the selection element that have a text that is listed in the texts parameter

HTML_Select.deselectByIndexes(indexes)

This function deselects the items of the selection element that have a index that is listed in the indexes parameter

int HTML_Select.selectedIndex

This property holds this selection element's selected index. (This property is only really useful for single selection boxes, that is, those of type select-one.)

String HTML_Select.selectedOption

This property is deprecated, please consider using the HTML_Select.selectedTexts property instead.

This property holds the selected option's text, or if this is a select (multi-selection) element, holds a string that contains a comma-separated list of the selected options' texts.

If this property is assigned to, it sets the option which has the same text as the given text to be selected.

If this is a select (multi-selection) element, the text string can specify a list of option texts by separating each one with a comma. In such cases, every option that has a text that matches one of the texts in the comma-separated list will be selected.

HTML_Select.setSelectedOption(text)

This function is deprecated, please consider using the HTML_Select.selectedTexts property instead.

This function selects the option with the given text in the select form element (which may be a select or select-one element). If the element is a multi-selection box, multiple options to be selected can be passed in the text separated by commas.

HTML_Select.setSelectedOptions(listOfTexts)

This function selects options from select form element (which may be a select or select-one element). For each entry in the listOfTexts a corresponding option with that visible text will be selected. If the element only allows single selection, the passed in listOfTexts has to contain only a single entry.

HTML_Select.setSelectedOptionByValue(value)

This function selects the option with the given value attribute in the select form element (which may be a select or select-one element).

HTML_Select.setSelectedOptionsByValue(listOfValues)

This function selects options from the select form element (which may be a select or select-one element). For each entry in the listOfValues a corresponding option with that value attribute will be selected. If the element only allows single selection, the passed in listOfValues has to contain only a single entry.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results