在编辑框中的xpage上,我想在使用backspace键时触发一些ssjs (设置作用域、调用托管bean中的函数、执行部分刷新)。
在csjs中,我可以检测到它:
$('html').keyup(function(e){if(e.keyCode == 8)alert('backspace trapped')}) 我怎么做这是SSJS?
发布于 2017-10-24 08:13:14
它变成了这样:
<xp:button value="Queue" id="btnQueue" styleClass="btn-primary">
<xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:actionGroup>
<xp:executeScript>
<xp:this.script>
<![CDATA[#{javascript://my action(s) here}]]>
</xp:this.script>
</xp:executeScript>
</xp:actionGroup>
</xp:this.action>
<xp:this.script>
<![CDATA[confirm("Are you sure you want to change from " + XSP.getElementById("#{id:inputFrom}").value +" to " + XSP.getElementById("#{id:inputTo}").value + "?")]]>
</xp:this.script>
</xp:eventHandler>
</xp:button>发布于 2017-10-20 07:41:07
您需要使用您拥有的CSJS代码,并通过CSJS启动部分刷新get / post。要触发特定的eventHandler,这段代码应该可以运行http://xpages.info/XPagesHome.nsf/Entry.xsp?documentId=88065536729EA065852578CB0066ADEC。SSJS将只在服务器上运行,因此这里没有用户击键的概念,只有发生击键后从浏览器传递的post请求数据。
https://stackoverflow.com/questions/46838046
复制相似问题