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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

nested fieldset problem in popup ?


Go to End
Reply


1210 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;
	}