Class Option
The option element represents an option in a select element or a suggestion in a datalist element. It defines a choice that users can select from a dropdown menu or autocomplete list. The value attribute specifies the value to be submitted, while the text content provides the display text.
Examples:
The following convenience methods are provided for constructing instances of this bean:
See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOption()Creates an emptyOptionelement.Creates anOptionelement with the specifiedHtmlElementText.text(Object)attribute.Creates anOptionelement with the specifiedvalue(Object)attribute andHtmlElementText.text(Object)node. -
Method Summary
Methods inherited from class org.apache.juneau.bean.html5.HtmlElementText
getText, setText, textMethods inherited from class org.apache.juneau.bean.html5.HtmlElement
accesskey, attr, attrUri, class_, contenteditable, deminimize, dir, getAttr, getAttr, getAttrs, hidden, id, lang, onabort, onblur, oncancel, oncanplay, oncanplaythrough, onchange, onclick, oncuechange, ondblclick, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting, self, setAttrs, spellcheck, style, tabindex, title, toString, translate
-
Constructor Details
-
Option
public Option()Creates an emptyOptionelement. -
Option
Creates anOptionelement with the specifiedHtmlElementText.text(Object)attribute.- Parameters:
text- TheHtmlElementText.text(Object)attribute. Can benull to leave the text unset.
-
Option
Creates anOptionelement with the specifiedvalue(Object)attribute andHtmlElementText.text(Object)node.- Parameters:
value- Thevalue(Object)attribute. Can benull to unset the attribute.text- TheHtmlElementText.text(Object)node. Can benull to leave the text unset.
-
-
Method Details
-
disabled
disabled attribute.Whether the form control is disabled.
This attribute uses deminimized values:
false - Attribute is not addedtrue - Attribute is added as"disabled" - Other values - Passed through as-is
-
label
label attribute.Specifies the user-visible label for the option. This label is displayed in the select element and can be different from the option's value.
The label should be user-friendly and descriptive of what the option represents.
- Parameters:
value- The user-visible label for the option. Can benull to unset the attribute.- Returns:
- This object.
-
selected
selected attribute.Whether the option is selected by default.
This attribute uses deminimized values:
false - Attribute is not addedtrue - Attribute is added as"selected" - Other values - Passed through as-is
-
value
value attribute.Value to be used for form submission.
-