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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

I want the complextablefield popup to show the name of a related object


Go to End


3 Posts   1180 Views

Avatar
baba-papa

Community Member, 279 Posts

1 November 2009 at 11:39am

Hi,

i have a DataObject "Products" that has a has_one relationship to "Manufacturer". When I add a new "Product" via the complextablefield the popup shows a dropdown of manufacturerID. I want the dropdown to show the Manufacturer->name. How can I do this?

Avatar
bummzack

Community Member, 904 Posts

1 November 2009 at 9:45pm

As far as I know, the DropdownField constructor takes an associative Array as source list. So you could simply populate the array with ManufacturerID => Manufacturer->Name pairs?

Avatar
baba-papa

Community Member, 279 Posts

2 November 2009 at 6:59am

Thanks for the hint banal. This is more complicated than i thought. I have to define a whole fieldset and pass it as a fifth argunemt to the constructor of the complextablefield. As soon as i figured it out ill post my result.