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:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

ImageDocumentManager getElementByID null issue

Go to End


Shawn Parr

Community Member, 60 Posts

12 September 2009 at 9:14am

Here is some more weirdness. I'm creating a custom page for one of our departments that needs to manage images. So I create a dataobject:

class Slide extends DataObject {
		static $has_one = array(
			'Image' => 'Image',
			'SlideshowPage' => 'SlideshowPage'
		public function getCMSFields_forPopup() {
			return new FieldSet(
				new ImageField('Image')

And a page to interact with it:

class SlideshowPage extends Page {
		static $db = array(
			'Speed' => 'Int'
		static $has_many = array(
			'Slides' => 'Slide'
		function getCMSFields() {
			$f = parent::getCMSFields();
			$slidemanager = new ImageDataObjectManager(
					'Image' => 'Image', 
			$f->addFieldToTab("Root.Content.Slides", $slidemanager);
			$f->addFieldToTab("Root.Content.Slides", new TextField('Speed', 'Slideshow speed in milliseconds'));
			return $f;

The popup appears and all the elements load properly. I click the button to choose files, and do so. They appear queued up. I click the upload button and get what appears to be a javascript alert that says: "TypeError: document.getElementById(params[name]) is null"

When this happens nothing else occurs, no upload, etc. I don't think it is an issue with SWFUploader as putting it in debug mode doesn't report any errors. Also opening the popup in its own tab and using the firefug console doesn't help either as no JS errors appear.

Were it gets weird is two fold:

1. If I change it to FileDocumentManager it works fine (this is my temporary workaround to get them going)
2. Image Gallery also works fine. When I create an image gallery page I can upload images all day long.

Any ideas?