Daniele Grillo
Daniele Grillo

Reputation: 1023

autosave function Ajax Mode - second part

Hi I have try to realize that...but I have some problem with CKeditor control:

autosave function in Ajax mode

With Firebug I see the POST sending for a simple field (text for example) but the post of CKEDITOR is not correct (I see only the initial value when I open the XPages)

have anyone any idea?

P.S. I have add this code into the onstart function:

for(var instanceName in CKEDITOR.instances) {
CKEDITOR.instances[instanceName].updateElement();
 }

Now I see the POST with correct HTML...don't seem work

Upvotes: 0

Views: 348

Answers (1)

Daniele Grillo
Daniele Grillo

Reputation: 1023

Ok I have resolve the problematic I have insert this native RichText code in top of my XPages:

function CKEDITOResubmit(idCKEDITOR){
  var rte=dijit.byId(idCKEDITOR);
  var txta=XSP.getElementById(idCKEDITOR+'_h');
  if(!rte || !txta) return;
  txta.value = rte.getValue();
  var mod=XSP.getElementById(idCKEDITOR+'_mod');
  mod.value=rte.isModified(txta.value);
  return true;
} 

When start automatic routine of Update:

executeOnServer('autoSaveDoc',null,
{'valmode': 1, 
   onStart:function() { 
            for(var instanceName in CKEDITOR.instances) {
              CKEDITOResubmit(instanceName)
            }
            btn.innerHTML="saving....";console.log("autosave start"); },
   onComplete:function() {btn.innerHTML="saved!"; console.log("autosave complete")},
   onError: function() {btn.innerHTML="error saving"; console.log("autosave error") }
 })

Upvotes: 3

Related Questions