Note that there are some explanatory texts on larger screens.

plurals
  1. POGlobal variables in SSJS script library not working as expected
    primarykey
    data
    text
    <p>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:</p> <p>Example XPage: </p> <pre><code>&lt;xp:this.resources&gt; &lt;xp:script src="/ssjsVisTest.jss" clientSide="false"&gt;&lt;/xp:script&gt; &lt;/xp:this.resources&gt; &lt;xp:inputText id="inputText1" value="#{document1.StatusTX}"&gt;&lt;/xp:inputText&gt; &lt;xp:br&gt;&lt;/xp:br&gt; &lt;xp:br&gt;&lt;/xp:br&gt; &lt;xp:br&gt;&lt;/xp:br&gt; &lt;xp:button value="Save" id="SaveBtn"&gt; &lt;xp:eventHandler event="onclick" submit="true" refreshMode="complete"&gt; &lt;xp:this.action&gt; &lt;xp:saveDocument var="document1"&gt;&lt;/xp:saveDocument&gt; &lt;/xp:this.action&gt; &lt;/xp:eventHandler&gt; &lt;/xp:button&gt; &lt;xp:br&gt;&lt;/xp:br&gt; &lt;xp:br&gt;&lt;/xp:br&gt; &lt;xp:label id="label1" value="Status is Draft" rendered="#{javascript:statusVisibleDraft()}"&gt; &lt;/xp:label&gt; &lt;xp:br&gt;&lt;/xp:br&gt; &lt;xp:br&gt;&lt;/xp:br&gt; &lt;xp:label id="label2" value="Status is Pending" rendered="#{javascript:statusVisiblePending()}"&gt; &lt;/xp:label&gt; &lt;xp:br&gt;&lt;/xp:br&gt; &lt;xp:br&gt;&lt;/xp:br&gt; &lt;/xp:view&gt; </code></pre> <p>Sample SSJS script library:</p> <pre><code>var status = document1.getItemValueString('StatusTX'); function statusVisibleDraft() { x = (status == "Draft") ? 1 : 0; if(x &gt; 0) { return true; } else { return false; } } function statusVisiblePending() { x = (status == "Pending") ? 1 : 0; if(x &gt; 0) { return true; } else { return false; } } </code></pre> <p>Any ideas? Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload