I implemented the ESC key feature in a banking application used by thouthands
of users.
I use XkinsForms (xkisn.sourceforge.net) that have a buttonTag that lets
you to generate the needed javascript to handle this feature:

<forms:execute key="button.cancel" executeParameter="stepBack" cancel="true"/>

This tag generates a javascript simmilar as the following:

<script>
function doSubmit() {
//submition code
}

function doCancel() {
//Cancel code
}
function processKeypressesDefault(e) { 
        var whichASCDef = (document.all?e.keyCode:e.which); 
        if (whichASCDef==13) {//enter
                doSubmit(); 
                return false; 
        } 
        return true; 
}

function processKeypressesCancel(e) { 
        var whichASCCan = (document.all?e.keyCode:e.which); 
        if (whichASCCan==27) {//escape
                doCancel(); 
                return false; 
        } 
        return true; 
}


function processKeypresses(e) {
        if(processKeypressesDefault(e))
                processKeypressesCancel(e);
        }
}

if (document.captureEvents) { 
        document.captureEvents(Event.KEYPRESS); 
        document.onkeypress = processKeypresses; 
} 

if(document.all) 
        document.attachEvent('onkeypress', processKeypresses);

</script>

You could extend Struts buttonTag and add this feature to your pages.

Cheers.
Guillermo.

________________________________________
FiberTel, el nombre de la banda ancha http://www.fibertel.com.ar



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to