Using 8.5.3 UP1. I'm having an issue with an SSJS script library that I am using for "hide/whens" or more exactly in xpages "show/ifs". In any case the global variables seem to take the value of the last time I saved the script library. They don't seem to compute based on the documents current value. Is this a known thing (obviously not known to me.). Here is a sample page and script library to demonstrate the issue:
Example XPage:
<xp:this.resources>
<xp:script src="/ssjsVisTest.jss" clientSide="false"></xp:script>
</xp:this.resources>
<xp:inputText id="inputText1" value="#{document1.StatusTX}"></xp:inputText>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:button value="Save" id="SaveBtn">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action>
<xp:saveDocument var="document1"></xp:saveDocument>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:label id="label1" value="Status is Draft"
rendered="#{javascript:statusVisibleDraft()}">
</xp:label>
<xp:br></xp:br>
<xp:br></xp:br>
<xp:label id="label2" value="Status is Pending"
rendered="#{javascript:statusVisiblePending()}">
</xp:label>
<xp:br></xp:br>
<xp:br></xp:br>
</xp:view>
Sample SSJS script library:
var status = document1.getItemValueString('StatusTX');
function statusVisibleDraft() {
x = (status == "Draft") ? 1 : 0;
if(x > 0) {
return true;
} else {
return false;
}
}
function statusVisiblePending() {
x = (status == "Pending") ? 1 : 0;
if(x > 0) {
return true;
} else {
return false;
}
}
Any ideas? Thanks