Jump to:

23455 Posts in 18904 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Can't select an image using ImageField

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

Page: 1
Go to End
Author Topic: 330 Views
  • Ronaldo71
    Avatar
    Community Member
    10 Posts

    Can't select an image using ImageField Link to this post

    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

    330 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.