问题
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