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:

Template Questions /

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

Set in template javascript without it in the template to specify

Go to End

3 Posts   856 Views


Community Member, 13 Posts

25 October 2012 at 4:34am

how can i set javascript in Frontend Template without '<% function %>'?
i want set it in class modelAdmin, the javascript should be on all sides.

regards, dh


Community Member, 10 Posts

25 October 2012 at 12:47pm

Hi Dh,
I'm not sure what you want here. Does this help?

You can use:


In your DataObject's getCMSFields() function. That will automatically load the javascript when the ModelAdmin loads that DataObject's class.

- Julian


Community Member, 13 Posts

25 October 2012 at 7:27pm

Edited: 25/10/2012 7:28pm

make it in Backend, i need it in Frontend, in the view area (in the *.ss - <head></head> or best on body tag end)

this is for my module.