1
0
-1

I have a Composer form. When you are presented with a Resume dialog after you've saved the form you can click on ESC and the Resume dialog will disappear and leave you with a blank form. Is there a way to suppress this default behaviour? 

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      Hi Brad, I am not sure whether there is any OOTB support for this by now, but on one of our previous projects we hooked up to the dialog's container (dlg- DOM element) and added the following JS


      dlg.on('keydown', function(event) {
      	if (sfc.isFormMode(formMode) && event.keyCode == 27) {
      		if( preventEsc ){
      			sfc.showAlert(preventEscMessage, "Warning", 1, 0);
      		} else {
      			sfcGenerated.closeDialog("");
      		}
      	}
      });
      1. Brad White

        I've tried similar approaches but it still won't work. I can see that my code runs but every dialog still goes away. I've tried with your JS and with JQuery.

        $(".sfc-dialog").on('keydown', function(event) {
            if (event.keyCode == 27) {
                console.log("Escape has been pressed1");
                event.preventDefault();
                return false;
            }
        });
      CommentAdd your comment...