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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

ModelAdmin manymany

Go to End

2 Posts   1652 Views


Community Member, 135 Posts

17 February 2010 at 1:20pm


I have a Designer object with a many_many connection to Regions. I edit them throught the ModelAdmin.

I have rebuilt the Regions tab for a designer with this code I found on the forum

	public function getCMSFields()
			$f = parent::getCMSFields();
			// rebuild the regions tab
			$regionsTablefield = new ManyManyComplexTableField(
				array('Title' => 'Title')
			$f->addFieldToTab('Root.Regions', $regionsTablefield);
			return $f;

This works, but only when I have done the following:

1/ Saved the Designer object and then
2/ Reloaded the designers list by pressing the tab at the top fo the ModelAdmin and
3/ Reopened my Designer object

When I try to add Regions when I first create the Designer, the Regions aren't saved. When I simply open the Designer without refreshing the list (step 2), it won't save anymore, the loading animation on the button will keep running.


Community Member, 135 Posts

16 March 2010 at 12:40am

I'm still looking in to this.

I have found out more:

1/ It only happens when a HTMLEditorField is added. I tried copying the modified ModelAdmin.js from this: But that didn't work.

2/ When I try to save a many_many relationship, I get this error: is null, which is something to do with TinyMCE.

3/ If I try to edit after the first save, these files don't seem to want to load (although they are available):