richtext control doesn't store the input content

不羁的心 提交于 2019-12-24 07:39:02

问题


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

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.

thanks for any help

Uwe


回答1:


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>

Now refresh the div instead:

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


来源:https://stackoverflow.com/questions/13588879/richtext-control-doesnt-store-the-input-content

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