Page 1 of 1

Cmsms not saving

Posted: Thu May 12, 2011 9:02 am
by stevess
I'm trying to use onfocus to remove text in a text field:

<textarea name="Question" onFocus="this.value=''; return false;">blah blah</textarea>

This works as static html but in CMSMS it accepts it on "apply" but once I've submitted and recalled it for further editing it only has this:

<textarea name="Question" > i.e not saving the JS.

In the head I have:

{literal}<__script__ type="text/javascript">
var clickedIt = false;

function cleartextarea(id){
if (clickedIt == false){
id.value="";
clickedIt=true;
}
}
</__script>
{/literal}


Any thoughts?

Similarly it won't save <div class="clear"></div>

I would be very grateful for any insight.

Re: Cmsms not saving

Posted: Thu Jun 09, 2011 11:11 am
by Mantlet
If this is in a WYSIWYG editor, that usually cleans up code before saving. It probably has nothing to do with CMSMS but with TinyMCE. You could put the javascript in a Global Content Block within {literal}{/literal} tags and call the GCB.

Hope this works out for you.

Re: Cmsms not saving

Posted: Thu Nov 24, 2011 7:12 pm
by stevess
A belated reply but thank you. That worked for one problem but trying to add a jscontroller="false" to an a tag wouldn't work. You're right it's Tiny cleaning up so i turned off the WYSIWYG.

I wonder if there's a neater solution.

Again thanks.

Re: Cmsms not saving

Posted: Sat Nov 26, 2011 3:33 am
by Wishbone
When I need custom HTML and WYSIWYG on the same page, I usually would put the custom HTML in a GCB (the entire <textarea> and not just the JS).. Make sure you turn off 'Use WYSIWYG'... not 'Turn WYSIWYG on/off'

Re: Cmsms not saving

Posted: Mon Dec 05, 2011 12:15 pm
by stevess
Thanks for the ideas.
Will try them out...

Re: Cmsms not saving

Posted: Thu Dec 15, 2011 3:09 am
by applejack
TinyMCE will remove empty divs unless you do below.

In the Advanced Tab > Extra Configuration add the lines
valid_elements : "*[*]",
extended_valid_elements : "*[*]"

[edited by moderator]

TinyMCE will also mess up any nicely formatted code and put it onto one line at times which why as mentioned above it is better to put it into a Global Content Block.