Hallo Ulrich,
ich kenn mich zwar mit Custom Controls nicht so aus (ich nehm mal an es geht hier um XPages und nicht um OLE-Controls) deshalb weiß ich auch nicht ob dir ein
try {
...some code
} catch(e) {
alert(e)
}
in Javascript weiter hilft.
Gruß
Roland
Habe jetzt eine teilweise Lösung.
Für den Fall, daß man ein Dokument als Datenquelle verwendet, kann man es so lösen.
<xp:this.data>
<xp:dominoDocument var="singleDoc" action="openDocument">
<xp:this.documentId>
<![CDATA[#{javascript:session.evaluate('@DbLookup("":"NoCache";"":"";"$lu-post-textbox";"' +
compositeData.category +'";3;[FAILSILENT])').elementAt(0)}]]></xp:this.documentId>
</xp:dominoDocument>
</xp:this.data>
<xp:this.loaded>
<![CDATA[${javascript:if (!session.evaluate('@DbLookup("":"NoCache";"":"";"$lu-post-textbox";"' + compositeData.category +'";3;[FAILSILENT])').elementAt(0)==""){
return true;
}
else {
return false;
}}]]></xp:this.loaded>
Wichtig ist das Keyword Dann liefert der @DBLookup einen leeren string anstelle eines fehlers zurück. Auf diesen leeren String kann man dann prüfen.
Das Ergebnis des @DBLookup kann man auch in eine Variable schreiben. Dann spart man sich die doppelte Ausführung des Codes.
Bei einer View als Datenquelle tue ich mich nach wie vor schwer ...
Sieht dann in der bereinigten Version so aus:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.data>
<xp:dominoDocument var="singleDoc" action="openDocument">
<xp:this.documentId>
<![CDATA[#{javascript:applicationScope.thisDocUNID =
session.evaluate('@DbLookup("":"NoCache";"":"";"$lu-post-textbox";"'
+ compositeData.category +'";3;[FAILSILENT])').elementAt(0);
return applicationScope.thisDocUNID;}]]>
</xp:this.documentId>
</xp:dominoDocument>
</xp:this.data>
<xp:panel style="height:2.0em;margin-bottom:0.5em" readonly="true">
<xp:label id="docSubject" styleClass="witteblue-15em">
<xp:this.value>
<![CDATA[#{javascript:if
(singleDoc.getItemValueString("showCaption") == "1"){
singleDoc.getItemValueString("Subject");
}
else {
return ' ';
}}]]>
</xp:this.value>
</xp:label>
</xp:panel>
<xp:inputRichText id="docBody" value="#{singleDoc.body}">
<xp:this.style>
<![CDATA[width:#{javascript:singleDoc.getItemValueString("blockwidth")}px]]>
</xp:this.style>
<xp:this.rendered>
<![CDATA[#{javascript:if (!applicationScope.thisDocUNID == ""){
return true;
}
else {
return false;
}}]]>
</xp:this.rendered>
</xp:inputRichText>
</xp:view>