Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Form Questions /

Dropdownfield, text alternative and 'required'


Reply


2 Posts   429 Views

Avatar
stellalie

Community Member, 10 Posts

6 October 2011 at 11:49am

I been struggling. Basically I would like design a form where the dropdown field is auto generated from existing database:

$f->push(new DropdownField('Extras',_t('CalendarDateTime.EXTRA','Extra', $this->getExtraOptions())));

Where getExtraOptions() returns for dropdown values. I would like this to be a required field, thus user will need to choose something from the dropdown menu. However, if user can't find best match in the dropdown, he/she will need to input the value in a textfield.

I was thinking to create a radiobox, if a value is selected then user need to choose a value from a dropdown, if other value is selected then user will need to put something on a text field.

How do I do this in Silverstripe?

Many thanks in advance.

Avatar
stellalie

Community Member, 10 Posts

7 October 2011 at 5:59pm

Oh well, I end up using front end jQuery validation instead. :S