2017-10-19 48 views
0

在编辑框的xpage上,我想在使用退格键时触发一些ssjs(设置scopevariable,调用托管bean中的函数,执行部分刷新)。关于退格键的使用消息ssjs

在csjs我可以检测到它:

$('html').keyup(function(e){if(e.keyCode == 8)alert('backspace trapped')}) 

我怎么做,这是SSJS?

+0

你需要按下退格时传递的数据? –

+0

该通话需要一些时间。退格时用户会注意到冻结。几个关键笔画将导致随机延迟和顺序的部分刷新。不要这样做。你到底想做什么? –

回答

0

它成为这样的:

<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>