My goal is to update an XPages scope variable using Client-side JavaScript. I have a complex XPage with multiple sections that are toggled on and off using Dojo. Within this XPage, there is a button that triggers some Server-side JavaScript. However, after the SSJS runs, the default visible section reappears instead of the section that was visible before clicking the button. I want to maintain the visibility of the section that was active before the button click even after executing the SSJS.
My idea is to utilize a scope variable - employ Client-side JavaScript to determine the current visible section on the XPage, store this in a scope variable, and then retrieve and display this value during the onClientLoad
event of the XPage to ensure the correct section is visible (while hiding all others). However, I have not been able to find a way to set a scope variable directly from Client-side JavaScript. I attempted to add
var xyz = "#{javascript:viewScope.put('sectionDisplay','Section')}"
to the onClick
event of the button, but this erroneously sets the scope variable even when the button is not clicked.
Prior to XPages, passing variables using query strings between pages was common. How can I accomplish this functionality now?