autosave function Ajax Mode - second part

牧云@^-^@ 提交于 2019-12-08 13:34:37

问题


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


回答1:


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") }
 })


来源:https://stackoverflow.com/questions/17065787/autosave-function-ajax-mode-second-part

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!