自动保存功能 Ajax 模式 - 第二部分 [英] autosave function Ajax Mode - second part

查看:21
本文介绍了自动保存功能 Ajax 模式 - 第二部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试意识到...但我在 CKeditor 控件方面遇到了一些问题:

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

Ajax 模式下的自动保存功能

使用 Firebug,我看到 POST 发送一个简单字段(例如文本),但 CKEDITOR 的帖子不正确(当我打开 XPage 时,我只看到初始值)

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)

有人知道吗?

附言我已将此代码添加到 onstart 函数中:

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

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

现在我看到带有正确 HTML 的 POST ......似乎不起作用

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

推荐答案

好的,我已经解决了问题,我已经在 XPage 顶部插入了这个原生 RichText 代码:

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

这篇关于自动保存功能 Ajax 模式 - 第二部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆