onclick removed

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
eop
New Member
New Member
Posts: 2
Joined: Sun Jun 27, 2021 8:57 pm

onclick removed

Post by eop »

Hello, When entering onclick in a tag (e.g., <button type="button" onclick="do_something()">Click me</button>), the onclick part gets removed on saving the content. All that's left is <button type="button">Click me</button>. It stays in a template but not when entering the code in a content box. Has anyone seen this before? Is there a workaround? Thanks.
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1625
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: onclick removed

Post by DIGI3 »

Scripts shouldn't be added in wysiwyg content areas, and the default setting of those editors is to strip it out. It's likely possible to disable that in the MicroTiny config (you can check their docs) but not really ideal.

Various options:
-Put the script in a generic template for the users to add with {include file='cms_template:myscript'} or similar
-Add a non-wysiwyg content block or disable the wysiwyg entirely for that page
-don't use onclicks, add the script to your template and have it tiggered by the class/id of the link
Not getting the answer you need? CMSMS support options
eop
New Member
New Member
Posts: 2
Joined: Sun Jun 27, 2021 8:57 pm

Re: onclick removed

Post by eop »

Thank you for the explanation and pointing me in the right direction.
Post Reply

Return to “CMSMS Core”