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:

Archive /

Our old forums are still available as a read-only archive.

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

error saving content on HasManyComplexTableField

Go to End



Community Member, 63 Posts

29 September 2008 at 8:53pm

Edited: 29/09/2008 8:55pm

Hi I'm getting the Error Saving Content on a page with a HasManyComplexTableField. I can't get to the error and have flushed DB and reviewed syntax 10 times, has anyone a hint on this ? Error gets away when I comment out the HasManyComplexTableField in ConfigPage ?

Thanks guys

=======UPDATE : ERROR FOUND : typo as usual - code below is now correct ====



class ConfigPage extends Page {
	static $icon = "tutorial/images/treeicons/news";
	static $db = array(

	static $has_one = array( 'Photo1' => 'Image'   );	
	 static $has_many = array(
      'Customers' => 'Customer'
     static $defaults = array(    'ShowInMenus' => false);
   function getCMSFields() {
   $fields = parent::getCMSFields();
   	$fields->addFieldToTab('Root.Content.Main', new ImageField('Photo1'), 'Content');
	  $tablefield = new HasManyComplexTableField(
	    'Name' => 'Name',
	    'Description' => 'Description',
	    'Url' => 'Url'
      $tablefield->setAddTitle( 'Customer' );
      $fields->addFieldToTab( 'Root.Content.Customer', $tablefield );
	return $fields;


class ConfigPage_Controller extends ContentController {
	function init() {



class Customer extends DataObject {
   static $db = array(
      'Name' => 'Text',
      'Description' => 'Text',
      'Url' => 'Text'
      static $has_one = array(
      'MyConfig' => 'ConfigPage'
   function getCMSFields_forPopup() {
      $fields = new FieldSet();
      $fields->push( new TextField( 'Name' ) );
      $fields->push( new TextField( 'Description' ) );
      $fields->push( new TextField( 'Url' ) );
      return $fields;