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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

SimpleHTMLEditorField doesn't show in popup


Reply


5 Posts   1447 Views

Avatar
PapaBear

Community Member, 26 Posts

15 September 2010 at 11:34am

Hi All,

I have a weird error. I have a site using HasManyDOM to hold testimonials for a page. The Testimonial class has two HTML fields using SimpleHTMLEditorField in the popup. This works fine in all standard browsers on my computer (IE6+, FF, Opera, Chrome, Safari) and my colleagues computer. However, on the client's computer the SimpleHTMLEditorFields are not appearing in the popup although the popup appears and the other fields appear. The popup functionality in all other respects is fine. A new testimonial can be created but with no way to edit the two HTML text fields. This behaviour is the same across all browsers on the client's machine (tried with IE8 and FF3.8)

I'm stumped as to possible cause. I suspect it's something locally on the client's machine but I can't seem to find anything that stands out as a cause.

Does anyone have a suggestion?

Avatar
cake

Community Member, 19 Posts

15 September 2010 at 9:31pm

Edited: 15/09/2010 9:33pm

Yes, I can confirm this issue. SimpleTinyMCEField isn't working, too.
DOM is outputting a regular Textarea within the popup.

I have set

Director::set_environment_type("dev");

in _config.php because there was a known bug. But that doesn't solve my problem.

I am using DOM r414 right now.

Avatar
cake

Community Member, 19 Posts

16 September 2010 at 3:07am

Edited: 16/09/2010 3:08am

Is this a related issue? http://www.silverstripe.org/upgrading-silverstripe/show/290536#post290536

Avatar
PapaBear

Community Member, 26 Posts

16 September 2010 at 7:52am

No, I'm not getting that issue. This website is using v2.3 and the related DOM version.

It only occurs on this client's pc as far as I can tell so I'm pretty confident it is something related to her machine but I don't have any idea what.

Avatar
silverseba

Community Member, 26 Posts

19 November 2010 at 5:25am

Edited: 19/11/2010 6:05am

Finally a fix!

I experienced the exact same problem with SS 2.4.3 and the latest revision of DataObjectManager (r511):
The SimpleHTMLEditorField never showed up in a regular PopUp window of any ComplexTableField (e.g. HasOneComplexTableField, HasManyComplexTableField, ManyManyComplexTableField)

The problem
When using any kind of *ComplexTableField, jQuery was NOT loaded in the iframe of the PopUp window.
So obviously none of the scripts of SimpleHTMLEditorField could run, because the required framework wasn´t loaded.

The simple fix
1. Use DataObjectManager instead of the *ComplexTableField (that´s what I´m doing now)

2. If you want to use a ComplexTableField, replace the following lines of function FieldHolder() in SimpleHTMLEditorField.php:

   public function FieldHolder()
   {
      Requirements::javascript('sapphire/thirdparty/jquery/jquery-packed.js'); // load jquery framework for following scripts to run
      Requirements::javascript('dataobject_manager/javascript/jquery.wysiwyg.js');
      Requirements::css('dataobject_manager/css/jquery.wysiwyg.css');
      Requirements::customScript("
         // use 'jQuery' call instead of '$' to prevent problems with prototype framework
         jQuery(function() {
            jQuery('#{$this->id()}').wysiwyg({
               {$this->getConfig()}
            }).parents('.simplehtmleditor').removeClass('hidden');
            
         });
      ");
      return parent::FieldHolder();      
   }

@UncleCheese: could you please add this fix to the source code of your module. This fix solves the problems when using a ComplexTableField, but doesn´t affect the use in combination with DataObjectManager.