TinyMCE and MonoRail AjaxHelper (II)

Here is a quick solution fot the "this.getDoc() error". The thing is that tinyMCE adds the control to the textarea successfully the first time but it can't add the control twice in the next load, so to remove the control when sending the form, could be a choice. Update the previous javascript functions to this ones:

function tinyRepaint() {
 var textarea_num = document.getElementsByTagName("textarea").length
 var textarea;
 for (var i = 0; i <= textarea_num; i++) {   textarea = document.getElementsByTagName("textarea")[i];   if (textarea != null) {    inst = tinyMCE.getInstanceById(textarea.id);    if (!inst) // just a test for debug     tinyMCE.execCommand("mceAddControl", false , textarea.id);   }  } }
function updateValues() {
  // manually save the tinyMCE content for each textarea
  var tas = document.getElementsByTagName('textarea');
  for(var i = 0; i < tas.length; i++) {   // snag the textarea    var ta = tas[i];    // put focus in the editor    tinyMCE.execInstanceCommand(ta.id, 'mceFocus');    // manually save the content    ta.value = tinyMCE.getContent();    tinyMCE.execCommand("mceRemoveControl", false , ta.id);   } }
Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.