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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Can't select an image using ImageField


Reply

344 Views

Avatar
Ronaldo71

13 December 2012 at 12:34am Community Member, 10 Posts

Hi all,

I've added an image to the Page class, but in the admin I can't select an image.
The dropdown combo in the admin won't expand, and I can't see any javascript errors. It's not styled properly either btw, see attached image.
The image is uploaded and it exists in the Files table. I've used a fresh, downloaded 3.0.3 install.
Here's the Page class:

class Page extends SiteTree {
   public static $db = array();

   public static $has_one = array(
    'BackgroundImg' => 'Image',
   );
   
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Main", new ImageField('BackgroundImg'));
return $fields;
}
}

Am I doing something wrong?

Best regards,
Ronald van Raaphorst