Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » ImageDocumentManager getElementByID null issue

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 1003 Views
  • Shawn Parr
    Avatar
    Community Member
    60 Posts

    ImageDocumentManager getElementByID null issue Link to this post

    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(
                $this,
                'Slides',
                'Slide',
                'Image',
                array(
                   'Image' => 'Image',
                ),
                'getCMSFields_forPopup'
             );
             
             $slidemanager->allowUploadFolderSelection();
             $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?

    1003 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.