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

Does anybody have a working example of DOM in the front-end?


Go to End
Reply


9 Posts   1942 Views

Avatar
CHD

Community Member, 218 Posts

31 March 2012 at 12:26am

Hmmmm I have it almost working. Well I can add objects via the frontend DOM now, but I cant figure out the relationships.

here's my code:

	function RatesForm(){
	$Apartment = $this->getApartment();	
	$Manager = new DataObjectManager( 
		$this->dataRecord,
		'Rates',
		'Rates',
		array('dateStart' => 'dateStart'),
		'getCMSFields_forPopup',
		'ApartmentID = ' . $Apartment->ID 
		);

	$Manager->setPermissions(array("show","edit", "add"));	
	$fields = new FieldSet(  
   $Manager
);	
	if($Apartment)	{
	$fields->push(new HiddenField('ID','ID',$Apartment->ID));
	} 
	
	return new Form($this->dataRecord, 'RatesForm', $fields, new FieldSet());
} 			

So that lists all the rates related to this apartment fine, but I can't edit them, clicking them throws up this error: [Notice] Trying to get property of non-object which is because I have the filter in there based on a $this request for apartment. as soon as you click the dataObject the URL changes and as a result there's no apartment to get an ID from.
As you can see I've put the Apartment ID into the form with a hidden field, but I can't figure out how to pass that to the DOM pop up.... if I take out the filter I can add/edit rates fine, but I need to make sure the user only see's the rates related to this apartment. I hope that makes sense!

can anybody shed any light on this?

P.S - my pop up still doesn't work either, it just opens a new page with the form fields, but I assume that can be fixed later, the pop up doesn't matter to the actual functionality, right?

Go to Top