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.

Archive /

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

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

adding a HasManyComplexTableField to a popup


Go to End


1261 Views

Avatar
Nivanka

Community Member, 400 Posts

17 November 2008 at 6:41am

I need to add a HasManyComplexTableField to a popup block,

Can I do this?


<?php

class Concert extends DataObject{

	static $db = array(
		"Content" => "Text"
	);

	static $has_one = array(
		"Ticket" => "TicketsPage"
	);

	static $has_many = array(
		"Seats" => "Seat"
	);

	function getCMSFields_forPopup(){

		$fields = new FieldSet();

		$fields->push(new TextField( 'Content', 'Content' ));

		$tablefield = new HasOneComplexTableField(
			$this,
			'Seats',
			'Seat',
			array(
				'Content' => 'Content',
				'Price' => 'Price'
			),
			'getCMSFields_forPopup'
		);
		$tablefield->setAddTitle('Seats');

		$fields->push($tablefield);


		return $fields;

	}
}

?>

this is my code