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

including javascript file to popup dataobject_manager


Go to End


3 Posts   1371 Views

Avatar
snaip

Community Member, 181 Posts

8 March 2011 at 10:45pm

i want to add my own javascript file to dataobject_manager popup

in DataObject_Manager.php add

Requirements::javascript('dataobject_manager/javascript/test.js');

test.js

(function($) {

alert('start');

        var option = $('#DataObjectManager_Popup_AddForm_FileID option:selected').text();
        alert(option);
})(jQuery);

the alert is shown when i reload the CMS but the next rules doesn't work

also this rule doesn't work too

$('.footer').css('background-color','#000');

.footer --> footer div of dataobject_manager popup

Avatar
snaip

Community Member, 181 Posts

9 March 2011 at 9:25pm

any idea ?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

10 March 2011 at 3:30am

I would think you'd put it in the getCMSFields() function for your dataobject, right? DataObjectManager is not the right controller for the popup.