从 ClientSide JS 调用 Eventhandler [英] Call Eventhandler from ClientSide JS

查看:20
本文介绍了从 ClientSide JS 调用 Eventhandler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在看 Jeremy Hodge 的这篇文章http://xpagesblog.com/XPagesHome.nsf/Entry.xsp?documentId=8680256565CBC使用事件处理程序并从 ClientSide JS 调用它们.但是,如果我在要触发的事件中加入一些 SSJS,我可以让它们工作.

I was looking at this post by Jeremy Hodge http://xpagesblog.com/XPagesHome.nsf/Entry.xsp?documentId=88065536729EA065852578CB0066ADEC With Event handlers and calling them from ClientSide JS. But I can get them to work if I put some SSJS in side the event I would like to fire.

这仍然有效还是我做错了什么?

Does this still work or am I doing something wrong?

    <xp:button value="click me" id="button1">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.script><![CDATA[executeOnServer('dostuff');]]></xp:this.script>

        </xp:eventHandler>
    </xp:button>
    <xp:eventHandler event="onfubar" id="dostuff" submit="true">
        <xp:this.action><![CDATA[#{javascript:print("1");viewScope.data="Y"}]]></xp:this.action>
    </xp:eventHandler>

executeOnServer 函数直接来自 Jeremys 页面

The executeOnServer function comes directly from Jeremys page

推荐答案

发现问题不在我的代码中,而是在 Executeonserver 代码中.感谢大家帮忙解决问题.

Found the problem my it wasn't in my code but in the Executeonserver code. Thanks everybody for the help to get the solution.

这一行需要改变dojo.query('[name="$$xspsubmitid"]')[0].value = form.id + ':' +functionName;

this line needed to change dojo.query('[name="$$xspsubmitid"]')[0].value = form.id + ':' +functionName;

dojo.query('[name="$$xspsubmitid"]')[0].value = functionName;

dojo.query('[name="$$xspsubmitid"]')[0].value = functionName;

当然,当你有了答案时,一切就变得简单了.

Of course when you have the answer everything seams easy.

这篇关于从 ClientSide JS 调用 Eventhandler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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