22996 Posts in 11620 Topics by 2826 members
|Go to End|
17 September 2011 at 10:51am
I am creating a form and I want to populate the DropdownField with items stored in a Product DataObject. I pretty much have it working but need to access the "Option" field which is the second field and not the "Name" field which is the first field.
I am using this
$Options = array('' => 'Please select') + DataObject::get('Product', "$this->ID",'Option')->toDropdownMap();
$f = new FieldSet(
new DropdownField('Color','Select Colour',$Options)
17 September 2011 at 2:48pm
You might want to use this instead then.
Dataobject::get("MyObject")->map("ID", "Title", "Please Select")
21 September 2011 at 3:42pm
That did the trick, that link had exactly the information I needed. Thanks for the help.
|Go to Top|