2017-10-19 46 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>