(17 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  
 
===Name===
 
===Name===
radio
+
select (dropdown)
 
===Type===
 
===Type===
_input
+
_select
 
===Synopsis===
 
===Synopsis===
 
How to use select with option fields to create a dropdown input
 
How to use select with option fields to create a dropdown input
 
===Description===
 
===Description===
The <code><_select></code> element is used to create a drop-down list.
+
The <code>select</code> element is used to create a drop-down list.
  
 
The <code>name</code> attribute is needed to reference the form data after the form is submitted (if you omit the <code>name</code> attribute, no data from the drop-down list will be submitted).
 
The <code>name</code> attribute is needed to reference the form data after the form is submitted (if you omit the <code>name</code> attribute, no data from the drop-down list will be submitted).
Line 13: Line 13:
 
The <code>id</code> attribute is needed to associate the drop-down list with a label.
 
The <code>id</code> attribute is needed to associate the drop-down list with a label.
  
The <code><_input type="option"></code>tags inside the <code><select></code> element define the available options in the drop-down list.
+
The <code><nowiki><_input type="option"></_input></nowiki></code>tags inside the <code><select></code> element define the available options in the drop-down list.
  
 
===Parameters===
 
===Parameters===
_input type="radio"
+
<code><nowiki><_select><_input type="option"></_input></_select></nowiki></code>
  
 
All other valid HTML5 attributes are allowed
 
All other valid HTML5 attributes are allowed
 
===Example===
 
===Example===
 
<syntaxhighlight lang="html">
 
<syntaxhighlight lang="html">
<p>Select a maintenance drone:</p>
+
<p>Select a car:</p>
 
<div>
 
<div>
  <_input type="radio" id="huey" name="drone" value="huey" />
+
    <_select name="car">
  <_label for="huey">Huey</_label>
+
<_input type="option" value="volvo">Volvo</_input>
 +
<_input type="option" value="saab">Saab</_input>
 +
</_select>
 
</div>
 
</div>
 
+
</syntaxhighlight>
 
<div>
 
<div>
  <_input type="radio" id="dewey" name="drone" value="dewey" checked="checked" />
+
<_select name="car">
  <_label for="dewey">Dewey</_label>
+
<_input type="option" value="volvo">Volvo</_input>
 +
<_input type="option" value="saab">Saab</_input>
 +
</_select>
 
</div>
 
</div>
  
<div>
+
<syntaxhighlight lang="html">
  <_input type="radio" id="louie" name="drone" value="louie" />
+
<_label for="dino-select">Choose a dinosaur:</_label>
  <_label for="louie">Louie</_label>
+
<_select id="dino-select">
</div>
+
    <optgroup label="Theropods">
</syntaxhighlight><p>Select a maintenance drone:</p><div>
+
        <_input type="option" value="Tyrannosaurus">Tyrannosaurus</_input>
  <_input type="radio" id="huey" name="drone" value="huey" />
+
        <_input type="option" value="Velociraptor">Velociraptor</_input>
  <_label for="huey">Huey</_label>
+
        <_input type="option" value="Deinonychus">Deinonychus</_input>
</div><div>
+
    </optgroup>
  <_input type="radio" id="dewey" name="drone" value="dewey" checked="checked" />
+
    <optgroup label="Sauropods">
  <_label for="dewey">Dewey</_label>
+
        <_input type="option" value="Diplodocus">Diplodocus</_input>
</div><div>
+
        <_input type="option" value="Saltasaurus">Saltasaurus</_input>
  <_input type="radio" id="louie" name="drone" value="louie" />
+
        <_input type="option" value="Apatosaurus">Apatosaurus</_input>
  <_label for="louie">Louie</_label>
+
    </optgroup>
</div>
+
</_select>
===Note===
+
</syntaxhighlight>
Radio buttons are similar to checkboxes, but with an important distinction — radio buttons are grouped into a set in which only one radio button can be selected at a time, whereas checkboxes allow you to turn single values on and off. Where multiple controls exist, radio buttons allow one to be selected out of them all, whereas checkboxes allow multiple values to be selected.
+
<_label for="dino-select">Choose a dinosaur:</_label>
===Links===
+
<_select id="dino-select">
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio
+
    <optgroup label="Theropods">
 +
        <_input type="option" value="Tyrannosaurus">Tyrannosaurus</_input>
 +
        <_input type="option" value="Velociraptor">Velociraptor</_input>
 +
        <_input type="option" value="Deinonychus">Deinonychus</_input>
 +
    </optgroup>
 +
    <optgroup label="Sauropods">
 +
        <_input type="option" value="Diplodocus">Diplodocus</_input>
 +
        <_input type="option" value="Saltasaurus">Saltasaurus</_input>
 +
        <_input type="option" value="Apatosaurus">Apatosaurus</_input>
 +
    </optgroup>
 +
</_select>
ws-class-props
Line 1: Line 1:
 
+
{{Doc properties
 +
|Doc subject=DevOps:Doc/FlexForm
 +
|Subject version=1.0,1.1
 +
|Doc parent=DevOps:Doc/FlexForm/1.0/input
 +
|Doc sort order=110
 +
|Doc target group=User
 +
|Doc synopsis=How to use select with option fields to create a dropdown input
 +
}}
ws-page-props
Line 1: Line 1:
{{Doc properties
+
 
|Subject version=1.0.0
 
|Doc subject=DevOps:Doc/FlexForm
 
}}
 

Latest revision as of 14:00, 22 September 2022

Name

select (dropdown)

Type

_select

Synopsis

How to use select with option fields to create a dropdown input

Description

The select element is used to create a drop-down list.

The name attribute is needed to reference the form data after the form is submitted (if you omit the name attribute, no data from the drop-down list will be submitted).

The id attribute is needed to associate the drop-down list with a label.

The <_input type="option"></_input>tags inside the <select> element define the available options in the drop-down list.

Parameters

<_select><_input type="option"></_input></_select>

All other valid HTML5 attributes are allowed

Example

<p>Select a car:</p>
<div>
    <_select name="car">
		<_input type="option" value="volvo">Volvo</_input>
		<_input type="option" value="saab">Saab</_input>
	</_select>
</div>

<_label for="dino-select">Choose a dinosaur:</_label>
<_select id="dino-select">
    <optgroup label="Theropods">
        <_input type="option" value="Tyrannosaurus">Tyrannosaurus</_input>
        <_input type="option" value="Velociraptor">Velociraptor</_input>
        <_input type="option" value="Deinonychus">Deinonychus</_input>
    </optgroup>
    <optgroup label="Sauropods">
        <_input type="option" value="Diplodocus">Diplodocus</_input>
        <_input type="option" value="Saltasaurus">Saltasaurus</_input>
        <_input type="option" value="Apatosaurus">Apatosaurus</_input>
    </optgroup>
</_select>