5099 Posts in 1519 Topics by 1116 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 193 Views |
-
Custom Javascript in the Admin

26 February 2013 at 4:35pm
I'm trying to add custom javascript to a tab in the CMS admin area
I can include the javascript easy enough by adding the following to the _config.php file
LeftAndMain::require_javascript('mysite/javascript/ContactPageAdmin.js');
However, the file loads in only once, when the CMS is first opened.
I need to run the script when the contact page is loaded in CMS.
And not just when it's loaded, but when it's saved, it needs to run again to refresh the content -
Re: Custom Javascript in the Admin

26 February 2013 at 11:03pm
You'll need to use Entwine for this, see here:
http://doc.silverstripe.org/framework/en/topics/javascriptThe best way to learn how Entwine works is to look at, for example, /framework/admin/javascript/LeftAndMain.EditForm.js.
I've recently done a similar thing, that calls a function whenever it detects a field (used for Google Maps):
https://github.com/kinglozzer/SilverStripe-GMapsPage/blob/master/javascript/GMapsPage.js
| 193 Views | ||
|
Page:
1
|
Go to Top |


