Custom Control - How to get compositeData in onClientLoad

43 Views Asked by At

After a timeout I logout the user and redirect to Login as described here:

NotesSpeak

A part of this code is executed in onCliendLoad().

    var thisUrl = window.location.pathname;
    var finalPath = thisUrl + "?Logout&redirectto=" + thisUrl + "?opendatabase&login";
    setAutoRefresh(15000, finalPath);

Now I want to use it on several XPages and add a custom control. With a custom property (needsLogout) I want to decide if the timeout should executed or not.

I created a custom control and a custom property called needsLogout. On SSJS I get this property using compositeData.needsLogout.

But I need this property in the onClientLoad. But this is CSJS and compositeData is not defined.

Is it possible to get the property in CSJS?

Sebastian

1

There are 1 best solutions below

1
theBastian On BEST ANSWER

My code in onClientLoad() looks like this.

if (!${compositeData.needsLogout}) {return false} 
else {
var thisUrl = window.location.pathname;
var finalPath = thisUrl + "?Logout&redirectto=" + thisUrl + "?opendatabase&login";
setAutoRefresh(15000, finalPath);
}