富文本控件不存储输入内容 [英] richtext control doesn't store the input content

查看:23
本文介绍了富文本控件不存储输入内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 XPage 有一个 RT 控件,用户可以在其中填充文本片段,并用更多文本完成内容.

my XPage has a RT-control in which the user can fill with text snippets, plus complete the content with more text.

填充按钮"的eventHandler:

The eventHandler of the "filling button":

<xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="Body1">
    <xp:this.action><![CDATA[#{javascript:
    var mykey = getComponent("Aufgabe1").getValue();
    var bodytxt:string = @DbLookup(@DbName(), "lookupOrdertypes",mykey,4,"[FAILSILENT]");
    if (checkContent(bodytxt)) getComponent("Body1").setValue(bodytxt);
}]]></xp:this.action>
</xp:eventHandler>

文本已填写,用户看到并再写一些.最后用户提交表单:但是在富文本字段中只保存了填充的文本片段!如果用户不使用该按钮,而只输入他的文本,则文本将被正确保存.

The text is filled in, the user see it and writes some some more. At last the user submits the form: But in the richtext field is only saved the filled in text snippet! If the user doesn't use that button, but types in only his text, the text is saved correctly.

当我将富文本控件更改为多行编辑框时,一切正常.

When I change the richtext control into a multiline edit box, everything works fine.

感谢您的帮助

乌维

推荐答案

问题是您没有完全刷新富文本,仅刷新具有富文本组件 id 的文本区域.但是还有两个其他组件需要刷新:inputRichText1_mod 和 inputRichText1_h,这是 XspInputRichText 组件中自动生成的两个字段.

The problem is that you are not refreshing the richtext completly, only the textarea with the id of the richttext component. But there are two other components which has to be refreshed: inputRichText1_mod and inputRichText1_h, two automatically generated fields from the XspInputRichText component.

如果你刷新周围的元素,你的代码应该可以工作:

If you refresh a surrounding element instead your code should work:

<xp:div id="refreshMe">
   <xp:inputRichText id="Body1" value="#{document1.Body}"></xp:inputRichText>
</xp:div>

现在刷新div:

<xp:eventHandler event="onclick" submit="true" refreshMode="partial" refreshId="refreshMe">
   <xp:this.action><![CDATA[#{javascript:
      var mykey = getComponent("Aufgabe1").getValue();
      var bodytxt:string = @DbLookup(@DbName(), "lookupOrdertypes",mykey,4,"[FAILSILENT]");
      if (checkContent(bodytxt)) getComponent("Body1").setValue(bodytxt);
   }]]></xp:this.action>
</xp:eventHandler>

这篇关于富文本控件不存储输入内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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