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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

How do I use Javascript in HTML source editor


Reply


2 Posts   460 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, 137 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)