Reputation: 315
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
Upvotes: 1
Views: 712
Reputation: 10485
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>
Upvotes: 5