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.

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

How do I use Javascript in HTML source editor


Go to End


2 Posts   992 Views

Avatar
ShambolicPaul

Community Member, 1 Post

15 June 2013 at 6:28am

Hello.
I am a total newbie and I've been trying to build a website for a friend as a favour.
I'm trying to insert some Javascript into the HTML source editor in the CMS but I click insert and nothing happens and the code seems to be stripped out.

I understand that tiny MCE might be stripping out the code? Any silverstripe experts out there know how I can just write and edit code like normal into the HTML editor? Some sort of setting I have to change or list of allowed elements to put into the config files or something.

I'm really at a loss here. Please help me.

Avatar
Nobrainer Web

Community Member, 138 Posts

15 June 2013 at 6:34am

I think you might be better of just placing the Javascript in the template file, or if you need to be able to add for each page via the CMS, add a normal textfield, instead of the HTMLEditorField.

See http://doc.silverstripe.org/framework/en/tutorials/2-extending-a-basic-site for info on how to add custom fields to the CMS.

Hope it helps :o)