I want to choose the type of my calendar events from some predefined values but also, create a new (custom) type if it's not listed.
So i have created the field in $db like so: 'Type' => 'Varchar', 'EventCustomType' => 'Varchar'
Then, in the getCMSFields() i have:
$f->addFieldsToTab("Root.Main", $eventType = new OptionsetField(
'Type',
_t('CalendarEvent.EVENTTYPE','Type'),
array (
'music' => _t('CalendarEvent.MUSIC','Music'),
'sport' => _t('CalendarEvent.SPORT','Sport'),
'drama' => _t('CalendarEvent.DRAMA','Drama'),
'custom' => TextField::create('EventCustomType','Event type')
)
)
);
The problem is that i don't know how to insert the label "Custom" before the Textareafield and style them in the same line.
Also, i'm not sure if i need a second field for the custom one. Can i insert the custom value inside "Type" field or validate it ?
Thanks for any suggestions