I'm trying to set an XPages scope variable from Client side JavaScript. I have an XPage which contains several sections which are shown or hidden using Dojo. On this XPage I have a button which executes some server side JavaScript. Once the SSJS behind the button executes, the section of the XPage which is visible by default is again visible, rather than the section which was visible immediately prior to the button being clicked. I would like the section which was visible prior to the button being clicked to also be visible after the SSJS behind the button has executed.
To do this I have thought of using a scope variable - use client side JavaScript to calculate which section of the XPage which is currently visible, set this value in a scope variable and read the scope variable in the onClientLoad
event of the XPage to again make this section visible (and hide all other sections).
However, I have found no way of setting a scope variable from client side JavaScript. I have tried adding
var xyz = "#{javascript:viewScope.put('sectionDisplay','Section')}"
to the onClick
client event of the button but this sets the scope variable regardless of whether the button is clicked or not.
Before XPages, I would have used the querystring to pass variable from one page to another. How can I now do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…