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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

SimpleTinyMCE field not working--javascript problem


Go to End


2 Posts   1712 Views

Avatar
theoldlr

Community Member, 103 Posts

7 March 2011 at 4:03am

My SimpleTinyMCEField has no buttons. I'm getting a JS error in firebug that points to '$(function(){' in this script:

<script type="text/javascript">//<![CDATA[

$(function() {
            $('#DataObjectManager_Popup_AddForm_Biography').tinymce({
             plugins : 'safari,paste',
             theme : 'advanced',
          theme_advanced_buttons1 : 'bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,styleselect,formatselect',theme_advanced_buttons2 : 'cut,copy,paste,pastetext,pasteword,|,bullist,numlist,|,link,unlink,anchor,image,|,code',theme_advanced_buttons3 : '',theme_advanced_buttons4 : '',   
          theme_advanced_toolbar_location : 'top',
       theme_advanced_toolbar_align : 'left',
       theme_advanced_statusbar_location : 'bottom',
       theme_advanced_resizing : false,
paste_auto_cleanup_on_paste : true,
paste_remove_spans: true,
paste_remove_styles: true,       
          content_css : ''
         
       });
       });

//]]></script>

I'm not sure how to fix this--I have no custom JS in the CMS here, it's all SS (2.4.5) and DOM (using r540)
Nothing jumps out at me immediately here except that it mentions 'safari' and I'm using firefox. It is on a mac though.
Any ideas? Thanks!

Avatar
s!m

Community Member, 9 Posts

12 March 2011 at 1:13am

Edited: 12/03/2011 1:14am

Hi theoldlr,

I've come across the same problem this morning, so I decided to share my simple solution:

The problem is, that sometimes not only jQuery but also prototype is included in the CMS, but both libraries are using the '$'-sign for different things, so the simple solution is to replace

$(function() { 

with
jQuery(function($) {

in line 186 in SimpleTinyMCEField.php
and you should have your SimpleTinyMCEField working... :)

@UncleCheese: I've attached a patch for this, maybe it would be useful to include this in dom's trunk...
link: http://pastie.org/1659285