Skip to content

Instantly share code, notes, and snippets.

@MartyIX
Created August 19, 2014 06:12
Show Gist options
  • Save MartyIX/711b25f8a1e5103112fd to your computer and use it in GitHub Desktop.
Save MartyIX/711b25f8a1e5103112fd to your computer and use it in GitHub Desktop.
Nette\Forms\Controls\SelectBox - <optgroup>
<?php
$countries = array(
'eu' => array(
'cs' => 'Cesko',
'sk' => 'Slovensko',
),
'en' => 'USA'
);
$form->addSelect('country', 'Zeme:', $countries);
?>
<select name="country" id="frm-myForm-country">
<optgroup label="eu">
<option value="cs">Cesko</option>
<option value="sk">Slovensko</option>
</optgroup>
<option value="en">USA</option>
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment