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

Unable to use javascript in ModelAdmin

Go to End

3 Posts   654 Views


Community Member, 96 Posts

17 July 2013 at 1:46am

I´m using SS2.4 with the RemodelAdmin ( for the project, I´m working on.

When you open an entry in RemodelAdmin to edit some values, an javascript should run if you change the value in an inputfield, something like that:

$('#Form_EditForm_Foo').on('keydown', function(){
//Do something

I´ve tried to use in the ModelAdmin class:


and the javascript is called correctly and it works perfectly for the search inputfields on the left for example,
but I can't figure out how to get it works for the right side.

I know that the javascript is loaded too soon to make things on the right side after I click on an entry,
but it must be possible to use javascript somehow?


Community Member, 244 Posts

17 July 2013 at 4:14pm

Edited: 17/07/2013 4:15pm

firstly, check the source code to check the js file is actually loading...

if is it is, you'll need 'entwine' it. The example below is runs when the a custom model is openned... simply put, it waits for a div with the class NameOfMyCustomAdmin' to appear, then adds the javascript.

you'll have to set it up to connect with

(function($) {

      onmatch: function() {
        // do your stuff


Community Member, 96 Posts

17 July 2013 at 9:44pm

Great, this is it, now it works! Great thanks!