IE doesn't submit form via AJAX when enter pressed

dwees - March 4, 2009 - 21:32
Project:Chatblock
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:dwees
Status:needs review
Description

This problem is easily solved, and whenever I get a chance to remember how to do CVS again and sit down and resubmit some fixes, I'll include it.

Add the following to the end of chatblock.js

// check to make sure JS is enabled and functional
if (Drupal.jsEnabled) {

  // add our stuff inside the header of the table
  $(document).ready(function() {
    $('#edit-chatblocktext').focus(function () {
  // add a keydown event on focus
      $(this).keydown(function (event) {
        // get the event which is browser dependent
        var e = event.which || event.keyCode;
         
        if (e == 13) {
  var el = document.getElementById('edit-chatblocksubmit');
  chatblockSend(el);
  return false;
}
else {
  return true;
}
  });
});

    $('#edit-chatblocktext').blur(function () {
  // get rid of the keydown when we don't need it anymore
  $(this).unbind('keydown'); 
});
  });
}

#1

dwees - March 4, 2009 - 21:34
Status:active» needs review

Fixing some formatting caused by a poor editor:

// check to make sure JS is enabled and functional
if (Drupal.jsEnabled) {

  // add our stuff inside the header of the table
  $(document).ready(function() {
    $('#edit-chatblocktext').focus(function () {
    // add a keydown event on focus
      $(this).keydown(function (event) {
        // get the event which is browser dependent
        var e = event.which || event.keyCode;
         
        if (e == 13) {
          var el = document.getElementById('edit-chatblocksubmit');
          chatblockSend(el);
          return false;
        }
        else {
          return true;
        }
      });
    });
 
    $('#edit-chatblocktext').blur(function () {
      // get rid of the keydown when we don't need it anymore
      $(this).unbind('keydown'); 
    });
  });
}

#2

sbart76 - March 6, 2009 - 11:26

For me it works :-) Thank you!

 
 

Drupal is a registered trademark of Dries Buytaert.