Download & Extend

IE doesn't submit form via AJAX when enter pressed

Project:Chatblock
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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'); 
});
  });
}

Comments

#1

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

For me it works :-) Thank you!

#3

Status:needs review» fixed

Patch modified and implemented. Works.

#4

Assigned to:dwees» Anonymous

#5

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here