Allow use of optgroup style of field choices

Uses field.flatchoices to select the first choice
from the field's choices, so that it works for fields
that use optgroups