Script keeps changing in wysiwyg / HTML mode

11 posts by 3 authors in: Forums > CMS Builder
Last Post: June 20, 2013   (RSS)

My client is trying to add a BrowseAloud Logo (http://www.browsealoud.com/) to a wysiwyg field in CMSB. He clicks on the HTML button, then pastes the snippet of code that BrowseAloud supplies:

<script type="text/javascript">var _baLocale = 'us';var _baUseCookies = true; var _baMode = 'logo'; var _baHiddenMode = false; var _baHideOnLoad = false;</script>
<script type="text/javascript" src="http://www.browsealoud.com/plus/scripts/ba.js"></script>

However, after he saves it, it changes to this:

<script type="text/javascript">// <![CDATA[
var _baLocale = 'us';var _baUseCookies = true; var _baMode = 'logo'; var _baHiddenMode =
false; var _baHideOnLoad = false;
// ]]></script>
<script type="text/javascript"></script>

I tried it myself, with the same result.

Any idea why it’s changing, or is this sort of script not supported by CMSB?

By rconring - June 18, 2013 - edited: June 18, 2013

Scripts need to be placed in a TEXT BOX field rather than WYSIWYG so they are inserted as text, not HTML.

Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987

Thanks for the reply, Ron.

That doesn't seem to apply with other code that I've pasted into a wysiwyg field that's in HTML mode; for example, YouTube embedding, or Google analytics. Any idea if there's a work around for this, please? My client is using the wysiwyg field for other information, too. It controls the pale blue panel that's in the bottom right of this page: http://www.wilmot.ca/.

Cheers.

By rconring - June 19, 2013 - edited: June 19, 2013

I think you will find that, in this case, it should work anyway in the altered state.  I have many BBB scripts that have been inserted into WYSIWYG fields and work just fine even though they were altered in the same manner by the editor.  the CDATA code has to do with XML rendering.  I have had problems in the past with some scripts that would only work when placed in a text field, so I try to make all script injection fields TEXT and have had no more problems.

Ron Conring
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987

By CommonSenseDesign - June 19, 2013 - edited: June 19, 2013

Thanks, Ron. I didn't think to check that the altered code was actually working!

EDIT: Okay, now that I've checked, the code isn't working as it's supposed to. There should be a logo appearing where the code is placed, but nothing is showing up.

I wonder if this is a version issue? I tried it on version 2.15, which is on my server, and it works okay. However, my client is using version 2.07, and nothing shows up. That being said, the code is being changed the same way when I paste the code into the HTML mode on both sites, but it only works correctly on mine.

By gregThomas - June 19, 2013

Hi,

I've done some local testing using the code you provided in the latest version of CMS Builder, and when I added the content to both the HTML of a WYSIWYG editor, and to a textarea field the code seemed to load correctly.

If the code is being changed the same way on both versions of CMS Builder it is unlikely to be a version problem, here is how the code is output in the latest version of CMS Builder:

<script type="text/javascript">// <![CDATA[var _baLocale = 'us';var _baUseCookies = true; var _baMode = 'logo'; var _baHiddenMode = false; var _baHideOnLoad = false;// ]]></script>
<script type="text/javascript" src="http://www.browsealoud.com/plus/scripts/ba.js"></script> 

Could the issue be being caused by conflicting JS scripts? When the code loads on your clients site are you getting any errors in the JavaScript console? (You can check it using ctrl+shift+j in Chrome). 

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

Hi, Greg.

No, I'm not getting any error messages at all when I test for confilcts.

By gregThomas - June 19, 2013

Hi,

Please could you fill in a second level support request for me? You can find the form here:

https://www.interactivetools.com/support/email_support_form.php

Then I can take a closer look into what is causing the problem. 

Thanks!

Greg

Greg Thomas







PHP Programmer - interactivetools.com

Done!