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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

ImageField & ImageDataObjectManager


Go to End


2 Posts   2646 Views

Avatar
Krille Brocket

Community Member, 10 Posts

6 January 2010 at 4:24am

Hi I runnng ss 2.4 and have a strange problem. I have a 1-many relation between a Gallery and a GalleryImage.
Im using ImageDataObjectManager in the Gallery page and everything worked fine until I added an ImageField.

The error im getting in firebug is:

C[L][K] is not a constructor
http://localhost/silverstripe/dataobject_manager/javascript/jquery-ui-1.6.js
Line 10

Here's some code:

class Gallery extends Page {
static $has_one = array(
"Image" => "Image"
};
static $has_many = array(
"GalleryImages" => "GalleryImage"
};
public function getCMSFields() {
$fields = parent::getCMSFields();
$imageField = new ImageField("Image","Image");
$fields->addFieldToTab("Root.Content.Main",$imageField);
$table = new ImageDataObjectManager(
$this,
"GalleryImages",
"GalleryImage",
"Image",
array()
);

$fields->addFieldToTab("Root.Content.Images",$table);
return $fields;
}
};

class GalleryImage extends DataObject {
static $has_one = array(
"Image"=>"Image",
"Gallery"=>"Gallery"
);
}

Avatar
Krille Brocket

Community Member, 10 Posts

7 January 2010 at 5:45am

The problem was a javascript being included in the Page_Controller.
I Removed the Requirements::javascript statement and used the template tag <% require javascript %> and now everything works fine=)