1

I am using ctools modal window to edit some records with Form API.
How can I prevent closing window with ESC key and the default close button?

0

I had similar kind of a problem. I had to disable closing modal popup by pressing ESC. In my case solution was adding unbind for modalEventEscapeCloseHandler for page where I was going to get modal popup:

<?php
      drupal_add_js('
      jQuery(document).ready(function(){
        jQuery(document).unbind("keydown", modalEventEscapeCloseHandler);
      });
      ', 'inline');
?>
  • I have checked. It's not disabling close modal popup with button - ESC – R.Rua Oct 12 '15 at 7:25
0

I tried like this and it works for me

$(function () {
    $('.modal').modal({
        show: true,
        keyboard: false,
        backdrop: 'static'
    });
});

If this won't work for you then try adding

data-keyboard="false"

Something like this:

<div class="modal hide fade" data-keyboard="false" 
role="dialog" aria-labelledby="myModalLabel" 
aria-hidden="true">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.