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:

General Questions /

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

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

Can't select an image using ImageField


Go to End


755 Views

Avatar
Ronaldo71

Community Member, 10 Posts

13 December 2012 at 12:34am

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