Wednesday, August 25, 2010

XPiNC: Prevent tabs being closed on ESC

A reader of my blog asked me how to prevent tabs being closed when pressing escape in XPages running in the Notes Client.

This client side code seems to work in Notes 8.5.2 at least:
dojo.addOnLoad( function(){ 
dojo.connect( document, 'keydown', function(e){
// 27 -> Key code for ESC -> stop event
if(e.keyCode === 27){ dojo.stopEvent(e); }


David Leedy said...

Great tip!!!! Thanks

Tim Tripcony said...

Thanks, Tommy! I was asked the same thing the other day... was assuming the correct approach would be something like what you posted, but I hadn't gotten an opportunity yet to verify.

Tommy Valand said...

No problem guys.. :)

Unknown said...

this could be fantastic. Can I implement this at the client level, not being part of the IT group?

Tommy Valand said...

I don't think so, if by that you mean that you don't have access to the source code of the XPage..?

Unknown said...

that's correct. I don't.