A possible value for an <apex:selectCheckboxes> or <apex:selectList> component. The <apex:selectOption> component must be a child of one of those components.
This component supports HTML pass-through attributes using the "html-" prefix. Pass-through attributes are attached to the generated <input> tag for components within an <apex:selectCheckboxes> or <apex:selectRadio> parent component, or to the generated <option> tag for components within an <apex:selectList> parent component.
<!-- Page: --> <apex:page controller="chooseColor"> <apex:form> <apex:selectList id="chooseColor" value="{!string}" size="1"> <apex:selectOption itemValue="red" itemLabel="Red"/> <apex:selectOption itemValue="white" itemLabel="White"/> <apex:selectOption itemValue="blue" itemLabel="Blue"/> </apex:selectList> </apex:form> </apex:page> /*** Controller ***/ public class chooseColor { String s = 'blue'; public String getString() { return s; } public void setString(String s) { this.s = s; } }
The example above renders the following HTML:
<select id="chooseColor" name="chooseColor" size="1"> <option value="red">Red</option> <option value="white">White</option> <option value="blue" selected="selected">Blue</option> </select>
Attribute Name | Attribute Type | Description | Required? | API Version | Access |
---|---|---|---|---|---|
dir | String | The direction in which the generated HTML component should be read. Possible values include "RTL" (right to left) or "LTR" (left to right). | 10.0 | global | |
id | String | An identifier that allows the selectOption component to be referenced by other components in the page. | 10.0 | global | |
itemDescription | String | A description of the selectOption component, for use in development tools. | 10.0 | global | |
itemDisabled | Boolean | A Boolean value that specifies whether the selectOption component should be displayed in a disabled state. If set to true, the option appears disabled. If not specified, this value defaults to false. | 10.0 | global | |
itemEscaped | Boolean | A Boolean value that specifies whether sensitive HTML and XML characters should be escaped in the HTML output generated by this component. If not specified, this value defaults to true. For example, the only way to add a ">" symbol to a label is by using the symbol's escape sequence and setting itemEscaped="false". If you do not specify itemEscaped="false", the character escape sequence displays as written. | 10.0 | global | |
itemLabel | String | The label used to display this option to users. | 10.0 | global | |
itemValue | Object | The value sent to the server if this option is selected by the user. | 10.0 | global | |
lang | String | The base language for the generated HTML output, for example, "en" or "en-US". For more information on this attribute, see the W3C specifications. | 10.0 | global | |
onclick | String | The JavaScript invoked if the onclick event occurs--that is, if the user clicks the selectOption component. | 10.0 | global | |
ondblclick | String | The JavaScript invoked if the onclick event occurs--that is, if the user clicks the selectOption component twice. | 10.0 | global | |
onkeydown | String | The JavaScript invoked if the onkeydown event occurs--that is, if the user presses a keyboard key. | 10.0 | global | |
onkeypress | String | The JavaScript invoked if the onkeypress event occurs--that is, if the user presses or holds down a keyboard key. | 10.0 | global | |
onkeyup | String | The JavaScript invoked if the onkeyup event occurs--that is, if the user releases a keyboard key. | 10.0 | global | |
onmousedown | String | The JavaScript invoked if the onmousedown event occurs--that is, if the user clicks a mouse button. | 10.0 | global | |
onmousemove | String | The JavaScript invoked if the onmousemove event occurs--that is, if the user moves the mouse pointer. | 10.0 | global | |
onmouseout | String | The JavaScript invoked if the onmouseout event occurs--that is, if the user moves the mouse pointer away from the selectOption. | 10.0 | global | |
onmouseover | String | The JavaScript invoked if the onmouseover event occurs--that is, if the user moves the mouse pointer over the selectOption. | 10.0 | global | |
onmouseup | String | The JavaScript invoked if the onmouseup event occurs--that is, if the user releases the mouse button. | 10.0 | global | |
rendered | Boolean | A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. | 10.0 | global | |
style | String | This attribute was deprecated in Salesforce API version 17.0 and has no effect on the page. | 10.0 | global | |
styleClass | String | This attribute was deprecated in Salesforce API version 17.0 and has no effect on the page. | 10.0 | global | |
title | String | The text to display as a tooltip when the user's mouse pointer hovers over this component. | 10.0 | global | |
value | Object | A merge field that references the controller class variable of type SelectOption that is associated with this selectOption component. For example, if the name of the associated variable in the controller class is myOption, use value="{!myOption}" to reference the variable. | 10.0 | global |