field-select
Clúdach field timpeall ar rogha dhúchasach. Thar deich rogha cuireann an select an bosca teaglama inscagtha in select.js i bhfeidhm; is í an rogha dhúchasach fós a sheolann an fhoirm.
Trí rogha: select dúchasach
Cuir é seo taobh istigh de <section rst-box><form rst-form>.
<div rst-field >
<label rst-field-label for ="sel_few" >Ról</label >
<select rst-input id ="sel_few" name ="sel_few" >
<option value ="admin" selected >Riarthóir</option >
<option value ="editor" >Eagarthóir</option >
<option value ="member" >Ball</option >
</select >
</div >
Cuir é seo taobh istigh de <section rst-box><form rst-form>.
{{ template "field-select" dict
"ID" "sel_few"
"Name" "sel_few"
"Label" "Ról"
"Options" (list
(dict "Label" "Riarthóir" "Selected" true "Value" "admin" )
(dict "Label" "Eagarthóir" "Value" "editor" )
(dict "Label" "Ball" "Value" "member" ))}}
Dhá rogha dhéag: an bosca teaglama inscagtha
Cuir é seo taobh istigh de <section rst-box><form rst-form>.
<div rst-field >
<label rst-field-label for ="sel_many" >Cathair</label >
<select rst-input id ="sel_many" name ="sel_many" data-rst-select data-rst-select-filter ="Clóscríobh chun scagadh" data-rst-select-results ="{n} toradh" data-rst-select-result-one ="1 toradh" data-rst-select-no-matches ="Níl aon toradh" aria-describedby ="sel_many-help" >
<option value ="dublin" selected >Baile Átha Cliath</option >
<option value ="lisbon" >Liospóin</option >
<option value ="madrid" >Maidrid</option >
<option value ="berlin" >Beirlín</option >
<option value ="rome" >an Róimh</option >
<option value ="athens" >an Aithin</option >
<option value ="helsinki" >Heilsincí</option >
<option value ="reykjavík" >Réicivíc</option >
<option value ="warsaw" >Vársá</option >
<option value ="zagreb" >Ságrab</option >
<option value ="tallinn" >Taillinn</option >
<option value ="valletta" >Vaileite</option >
</select >
<p rst-field-help id ="sel_many-help" >Tosaigh ag clóscríobh chun scagadh.</p >
</div >
Cuir é seo taobh istigh de <section rst-box><form rst-form>.
{{ template "field-select" dict
"ID" "sel_many"
"Name" "sel_many"
"Label" "Cathair"
"Options" (list
(dict "Label" "Baile Átha Cliath" "Selected" true "Value" "dublin" )
(dict "Label" "Liospóin" "Value" "lisbon" )
(dict "Label" "Maidrid" "Value" "madrid" )
(dict "Label" "Beirlín" "Value" "berlin" )
(dict "Label" "an Róimh" "Value" "rome" )
(dict "Label" "an Aithin" "Value" "athens" )
(dict "Label" "Heilsincí" "Value" "helsinki" )
(dict "Label" "Réicivíc" "Value" "reykjavík" )
(dict "Label" "Vársá" "Value" "warsaw" )
(dict "Label" "Ságrab" "Value" "zagreb" )
(dict "Label" "Taillinn" "Value" "tallinn" )
(dict "Label" "Vaileite" "Value" "valletta" ))
"Help" "Tosaigh ag clóscríobh chun scagadh." }}
Thar deich rogha, cuireann an pháirt select.js i bhfeidhm. Faoi bhun deich gcinn ní chuireann: níl i gcuardach ar dhornán rudaí ach troscán, ní cabhair.
Dhá rogha dhéag, Plain: diúltaíodh don fheabhsú
Cuir é seo taobh istigh de <section rst-box><form rst-form>.
<div rst-field >
<label rst-field-label for ="sel_plain" >Cathair</label >
<select rst-input id ="sel_plain" name ="sel_plain" >
<option value ="dublin" selected >Baile Átha Cliath</option >
<option value ="lisbon" >Liospóin</option >
<option value ="madrid" >Maidrid</option >
<option value ="berlin" >Beirlín</option >
<option value ="rome" >an Róimh</option >
<option value ="athens" >an Aithin</option >
<option value ="helsinki" >Heilsincí</option >
<option value ="reykjavík" >Réicivíc</option >
<option value ="warsaw" >Vársá</option >
<option value ="zagreb" >Ságrab</option >
<option value ="tallinn" >Taillinn</option >
<option value ="valletta" >Vaileite</option >
</select >
</div >
Cuir é seo taobh istigh de <section rst-box><form rst-form>.
{{ template "field-select" dict
"ID" "sel_plain"
"Name" "sel_plain"
"Label" "Cathair"
"Options" (list
(dict "Label" "Baile Átha Cliath" "Selected" true "Value" "dublin" )
(dict "Label" "Liospóin" "Value" "lisbon" )
(dict "Label" "Maidrid" "Value" "madrid" )
(dict "Label" "Beirlín" "Value" "berlin" )
(dict "Label" "an Róimh" "Value" "rome" )
(dict "Label" "an Aithin" "Value" "athens" )
(dict "Label" "Heilsincí" "Value" "helsinki" )
(dict "Label" "Réicivíc" "Value" "reykjavík" )
(dict "Label" "Vársá" "Value" "warsaw" )
(dict "Label" "Ságrab" "Value" "zagreb" )
(dict "Label" "Taillinn" "Value" "tallinn" )
(dict "Label" "Vaileite" "Value" "valletta" ))
"Plain" true }}
Riachtanach, le hearráid
Cuir é seo taobh istigh de <section rst-box><form rst-form>.
<div rst-field >
<label rst-field-label for ="sel_error" >Ról</label >
<select rst-input id ="sel_error" name ="sel_error" required aria-invalid ="true" aria-describedby ="sel_error-error" >
<option value ="admin" selected >Riarthóir</option >
<option value ="editor" >Eagarthóir</option >
<option value ="member" >Ball</option >
</select >
<p rst-field-error id ="sel_error-error" role ="alert" >Roghnaigh ról don duine seo.</p >
</div >
Cuir é seo taobh istigh de <section rst-box><form rst-form>.
{{ template "field-select" dict
"ID" "sel_error"
"Name" "sel_error"
"Label" "Ról"
"Options" (list
(dict "Label" "Riarthóir" "Selected" true "Value" "admin" )
(dict "Label" "Eagarthóir" "Value" "editor" )
(dict "Label" "Ball" "Value" "member" ))
"Required" true
"Error" "Roghnaigh ról don duine seo." }}
Scríofa de láimh, le optgroups
Cuir é seo taobh istigh de <section rst-box><form rst-form>.
<div rst-field >
<label rst-field-label for ="sel_grouped" >Réigiún</label >
<select rst-input id ="sel_grouped" name ="sel_grouped" data-rst-select data-rst-select-filter ="Clóscríobh chun scagadh" data-rst-select-results ="{n} toradh" data-rst-select-result-one ="1 toradh" data-rst-select-no-matches ="Níl aon toradh" >
<optgroup label ="an Eoraip" >
<option value ="dublin" selected >Baile Átha Cliath</option >
<option value ="lisbon" >Liospóin</option >
<option value ="warsaw" >Vársá</option >
</optgroup >
<optgroup label ="Meiriceá" >
<option value ="montreal" >Montréal</option >
<option value ="lima" >Líoma</option >
<option value ="austin" >Austin</option >
</optgroup >
<optgroup label ="an Áise" >
<option value ="osaka" >Ósaca</option >
<option value ="hanoi" >Hanoi</option >
<option value ="dhaka" >Dacca</option >
</optgroup >
<optgroup label ="an Afraic" >
<option value ="accra" >Accra</option >
<option value ="nairobi" >Nairobi</option >
<option value ="tunis" >Túinis</option >
</optgroup >
</select >
</div >
Is liosta cothrom é Options anseo, mar sin is marcáil a scríobhann an feidhmchlár féin iad na roghanna grúpáilte. Léiríonn select.js na grúpaí seachas iad a chaitheamh amach; is féidir le rogha scríofa de láimh an feabhsú a dhiúltú ar fad le data-rst-select="false".