Sarge for ExpressionEngine
While working on the CMS for Navigant I had a need for adding <optgroup>s to a Drop-down List field. So I wrote this little extension that overrides ExpressionEngine’s built-in drop-down creation function. On top of <optgroup> support, you can also use it to specify each option’s value.
Installation Instructions
- Download the latest version (below)
- Upload
ext.sarge.phptosystem/extensions/ - Enable Sarge in the Extensions Manager
Example Syntax
If you were to enter the following code into the Select Options text box in the Field Settings…
Select an Option =
[optgroup] = Fruit
Apple = apl
Orange = org
Mango = mgo
[/optgroup]
[optgroup] = Veggies
Bell Pepper = bpr
Carrot = crt
Potato = pto
[/optgroup]
…It would become what follows in the Publish form.
<option value="">Select an Option...</option>
<option value=""></option>
<optgroup label="Fruit">
<option value="apl">Apple</option>
<option value="org">Orange</option>
<option value="mgo">Mango</option>
</optgroup>
<optgroup label="Veggies">
<option value="bpr">Bell Pepper</option>
<option value="crt">Carrot</option>
<option value="pto">Potato</option>
</optgroup>
If you do not specify a value for an option, it will behave just like it would without this extension (the value would be set to the label).
- Download Sarge 1.0.0 (requires ExpressionEngine 1.4 or later)