Search code examples
xpagesxpages-ssjs

on backspace key usage fire ssjs


On an xpage in an edit box I would like to fire some ssjs (set scopevariable, call a function in a managed bean, perform a partial refresh) when the backspace key is used.

in csjs I could detect it:

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

How do I do this is SSJS?


Solution

  • it became something like this:

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