从链接执行待机对话框 [英] execute standby dialog from link

查看:76
本文介绍了从链接执行待机对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我所拥有的:Xpages页面,该页面通过按键根据url参数填写表单.最多可能需要10秒钟才能呈现,我想让用户知道表单正在做某事.

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做了一个很棒的待机对话框,当我在按钮上使用它时,它的工作很棒(保存) http://openntf.org/XSnippets.nsf/snippet .xsp?id = standby-dialog-custom-control (保存时对表单ID进行部分更新)

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)

如何从电子邮件中的链接执行此脚本块? 有诸如beforepageload,afturpageload之类的选项,或者我应该使用beforeRenderResponse 如果可以的话,我该怎么做.

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.

推荐答案

我将XPage加载为空,并具有一个隐藏按钮,该按钮将在页面的onload事件中单击. 此按钮将执行一些服务器端SSJS,该SSJS将显示您要显示的控件.然后,备用"小部件将负责其余的工作.用户将看到等待对话框.

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()}]]>)

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"

这篇关于从链接执行待机对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆