1955 Posts in 1234 Topics by 601 members
|Go to End|
5 February 2013 at 8:00am
I have a custom form for updating a database row. I pre-populate the field values using $form->loadDataFrom( $data ), where $data is an associative array of the field values.
This works great for all but the DropdownField; nothing is set as "selected".
On the form subclass:
$fields = FieldList::create(
DropdownField::create('subscribed')->setSource(array('1' => 'Yes', '0' => 'No'))->setAttribute('class', 'default')
In the controller:
I have verified that $data is a properly formatted associative array (after all, every other field gets the appropriate value).
The dropdown field will not set a selected value.
9 February 2013 at 6:57am
I ended up switching to Yes/No radio buttons.
|Go to Top|