21301 Posts in 5735 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 527 Views |
-
Creating option list from DataObject

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)
); -
Re: Creating option list from DataObject

17 September 2011 at 2:48pm
You might want to use this instead then.
Dataobject::get("MyObject")->map("ID", "Title", "Please Select")
See more: http://www.ssbits.com/tutorials/2010/dynamically-generating-a-dropdown-list/
-
Re: Creating option list from DataObject

21 September 2011 at 3:42pm
That did the trick, that link had exactly the information I needed. Thanks for the help.
| 527 Views | ||
|
Page:
1
|
Go to Top |


