Hi,
I am having a heck of a time getting selected items from a ListboxField to save properly in the database. I'm hoping someone might be able to help me. Here is my code:
<?php
class Networks extends DataObject {
function getCMSFields_forPopup() {
$fields = new FieldSet();
$VerticalSet = DataObject::get("Verticals", '','VerticalName ASC','','');
$dropdownfield = new ListboxField('Verticals', 'Select Associated Verticals', $VerticalSet->toDropDownMap('ID', 'VerticalName'),'VerticalName', 10, true, '');
$fields->push($dropdownfield);
return $fields;
}
}
...where "Verticals" is a separate table with a field called Verticals where I wish to store the selected items in this Listbox. But I have two problems.
1.) When I pop up the window to add or modify a Network (that's the DataObject which needs to contain this info),I get this error @ the top of the page:
"Notice: Undefined variable: options in C:\wwwroot\wamp\www\adify\sapphire\forms\ListboxField.php on line 68"
2.) The value of the field stores in the database as "Array".
What am I doing wrong???
I know my Value paramter (the 4th param of the ListboxField contrsuctor is wrong, but I don't know what it SHOULD be).
Thanks everyone in advance for your help!
//Garrett