Here is what i have : Xpages page that fills in form based on url parameter by key. This can take upto 10 sec to render and i would like to let the user know that the form is doing something.
Fredrik Norling did a great standby dialog and its works great when i use it on button(save) http://openntf.org/XSnippets.nsf/snippet.xsp?id=standby-dialog-custom-control (am using Partial update on ID on the form when saved)
How can i execute this script block from a link in a email ? There are option like beforepageload , afturpageload or should i use beforeRenderResponse and if so how to i do that.
I would load the XPage empty and have a hidden button that would be clicked in the onload event of the page. This button will execute some serverside SSJS that will show the controls the you want to show. Then the Standby widget will take care of the rest. And the user will get the wait dialog.
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:button value="Clickme" id="LoadWait"
style="visibility:hidden;display:none">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" refreshId="MainContent">
<xp:this.action><![CDATA[#{javascript:viewScope.HideOnLoad=true}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
<xp:div id="MainContent">
<xp:div>
<xp:this.rendered><![CDATA[#{javascript:if(!viewScope.HideOnLoad){
return false
}else{
return true
}}]]></xp:this.rendered>
<xp:div>
<xp:table>
<xp:tr>
<xp:td>
<xp:label id="label1">
<xp:this.value><![CDATA[#{javascript:var startTime = new Date().getTime();
var elapsedTime = 0;
var timeOutSeconds = 20;
while ( elapsedTime < timeOutSeconds) {
java.lang.Thread.currentThread().sleep(1000);
//re-check condition here
elapsedTime = (new Date().getTime() - startTime) / 1024;
}
return "Name1"}]]></xp:this.value></xp:label></xp:td>
<xp:td>
<xp:inputText id="inputText1"
value="#{viewScope.Name}">
<xp:this.defaultValue><![CDATA[#{javascript:"test"}]]></xp:this.defaultValue></xp:inputText></xp:td>
</xp:tr>
<xp:tr>
<xp:td>
<xp:label value="Company" id="label2"></xp:label></xp:td>
<xp:td>
<xp:inputText id="inputText2"
value="#{viewScope.Company}">
</xp:inputText></xp:td>
</xp:tr>
</xp:table></xp:div>
</xp:div>
</xp:div>
<xc:standby></xc:standby>
<xp:eventHandler event="onClientLoad" submit="false">
<xp:this.script><![CDATA[//increase timeout value for long running XPage requests
dojo.onLoad(function(){ XSP.submitLatency = 600 * 1000;var id="#{id:LoadWait}";document.getElementById(id).click()}]]>
To make the code work you need to have the standby widget code added in to a custom control called "standby"