Results 1 to 2 of 2

Thread: How do I prevent a form on a modal window from closing when a user pushes ESC?

  1. #1

    Default How do I prevent a form on a modal window from closing when a user pushes ESC?

    I have a simple 2-field form in a modal dialog but when a field has focus and the user pushes the ESC key the whole dialog closes. I don't want this to happen. What's weird is it only happens when a field has focus, not when the window has focus.

    Here is a fiddle: https://fiddle.sencha.com/#view/editor&fiddle/35rg

    Any Help would be appreciated.

  2. #2

    Default

    Since no one else replied here I figured I'll post the solution I found.

    first if you don't need the full functionalty of a form you can replace a formpanel with a fieldpanel, and it will naturally remove the ENTER and ESC to auto submit and auto cancel

    If you're keeping a form however and wish to just remove the ESC shortcut you can add these parameters

    Code:
    keyMapEnabled: false,
        keyMap: {
          ESC: 'onEscape',
          scope: 'this'
        },
    I placed this on my window and it disabled closing the window on ESC.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •