Reputation: 901
I met some strange problem. A page button does not execute SSJS when it's clicked first time after page load. But does work when you click it again. I found it especially when you clear browser cache.
What could cause this behavior? It can be any SSJS not exactly context.redirectToPage. But it works only when you click button second time. Same problem found on FF but it does work in IE.
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:button id="button1" styleClass="btn btn-primary btn-sm"
value="My Button" title="My Button">
<span class="glyphicon glyphicon-edit"></span>
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete" id="eventHandler10">
<xp:this.action><![CDATA[#{javascript:context.redirectToPage("TEST.xsp?param1=true");}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:view>
Here is my app configuration options:
Upvotes: 3
Views: 359
Reputation: 901
This does help when you put it into afterPageLoad event.
if(!sessionScope.APP_LOADED){
sessionScope.put("APP_LOADED", true);
context.reloadPage();
}else if(sessionScope.APP_LOADED==false){
sessionScope.put("APP_LOADED", true);
context.reloadPage();
}
Upvotes: 1
Reputation: 2359
I think I had a similar problem. I had to add an OnClientLoad action, with nothing in it. Why exactly I don't know.
Upvotes: 0
Reputation: 1417
You have to set the following parameter, then it should work as expected:
Upvotes: 0