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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

nested fieldset problem in popup ?


Go to End


1523 Views

Avatar
Artyom

Community Member, 22 Posts

8 July 2010 at 10:14am

The following code produces this error in the popup

 Uncaught Exception: Object->__call(): the method 'name' does not exist on 'FieldSet

It started when I added the IsSeparator bit with the second SelectionGroup. Can the code not handle neste fieldsets or ?

-thanks

class ScheduleItem extends DataObject {


	static $linkValues = array(
		'None' 		=> 'none',
		'Events'	=> 'Workshops & Events',
		'LevelOne'	=> 'Level I',
		'LevelTwo'	=> 'Level II',
		'Specified'	=> '(specified)'
	);


	static $db = array(
		'IsSeperator'	=> 'Boolean',
		'Date' 		=> 'Text',
		'Title' 	=> 'Text', 
		'Byline' 	=> 'Text', 
		'Presenter' => 'Text',
		'Time' 		=> 'Text',
		'Venue' 	=> 'Text',
		'LinkType' 	=> "Enum('None, Events, LevelOne, LevelTwo, Specified', 'None')",
		'SpecifiedLink' 		=> 'Varchar(150)',
		'IsFeaturedEvent' 		=> 'Boolean'
	);
	
	static $has_one = array(
		'SchedulePage' => 'SchedulePage'
	);
	
	static $defauls = array (
		'IsSeperator' => false
	);
	
	static $singular_name = 'Schedule Entry';
	static $plural_name = 'Schedule Entries';
	
	function getCMSFields_forPopup() {
		$fields = new FieldSet(
			new SelectionGroup(
				"IsSeperator", 
				array(
					'1//Seperator Bar' => new HiddenField(""),		
					'0//Event' => new FieldSet (
						new TextField('Date'),
						new TextField('Title'),
						new TextField('Byline'),
						new TextField('Presenter'),
						new TextField('Time'),
						new TextField('Venue'),
						new SelectionGroup(
							"LinkType", 
							array(
								"None//No Link" => new HiddenField(""),
								"Events//Workshops & Events" => new HiddenField(""),
								"LevelOne//Level I" => new HiddenField(""),
								"LevelTwo//Level II" => new HiddenField(""),
								"Specified//Specify a link" => new TextField('SpecifiedLink', 'Fully specified URL (eg, "http://mysite.com/event.html"')
							)
						),
						new CheckboxField ("IsFeaturedEvent", "Show on homepage")
					)
				)
			)
		);
		return $fields;
	}