Content Block stripping out "onChange" from HTML S

Posted by jfellrath on 18-Jul-2019 17:10

Hi all,

I am trying to add an onChange event to an HTML Select tag in a Content Block on a Sitefinity page. Despite the fact that I've sent configuration on RadEditor filters for Content block, Rad Editor's content filters, and Rad Editor strip formatting options to "None", the code is being stripped out upon even switching from HTML to the WYSIWYG editor. I have the Javascript in its own MVC control and some CSS in the <head> tag for this, but only the onChange is being removed. 

We're on version 11.0.6721.0.

Thanks,

Jamie

All Replies

Posted by bwilson on 18-Jul-2019 18:03

Maybe it's the HTML sanitization? You can go to  Administration » Settings » Advanced » Security. Check the Disable HTML sanitization checkbox.  If you don't want to completely disable all sanitization, you can whitelist items (I haven't tried this):

www.progress.com/.../html-sanitization

Posted by gauntt@upenn.edu on 18-Jul-2019 18:08

Sounds like you are using MVC. The editor settings in the basic settings section only applied to the RadEditor, i.e. webforms mode. In MVC mode you are using the Kendo editor.

You have two options:

1) This is the official new way of working. Any javascript on the page should be written as a standalone block of code and put in a javascript widget since any scripting will be automatically deleted out of content blocks.

2) If you really hate this and want to disable it, you can go to the source code repository and download the "sf-html-field.js" file and put it in your ResourcePackages/yourpkg/client-components/fields/html-field folder so it will override the built-in file. I don't remember what the line is that you have to change to disable the auto-script scrubbing so you might have to do some more searching to find it. I decided not to do this, because once you do it you are signing on to MANUALLY manage that file from now on. Every time you do a version upgrade you will need to compare the new version of this file to your version and copy in any updates.

www.progress.com/.../extend-the-html-field-of-the-rich-text-editor

Posted by jfellrath on 18-Jul-2019 18:35

Bwilson - I tried this. We already had it turned off for other purposes, though. Thanks for helping!

Posted by jfellrath on 18-Jul-2019 18:36

Gaunt - thanks, I'll give that a try! 

Posted by jfellrath on 18-Jul-2019 21:09

Turns out that the listener was being started up, the problem was how Sitefinity was handling the actual stuff I was doing in my function.  Thanks for the help, gents!

This thread is closed