But I wanna use the Enter key!

If you’ve ever worked on a page in Arena that has the Person Quick Search module, you’ll notice that it automatically steals the cursor focus.  Which also means that it steals the use of the Enter key…at all times.

Let’s say you want to add a form to an Advanced HTML Text module and would like for someone to be able to use the Enter key to submit it.  You’re going to need a bit of JavaScript to make this happen.

I want to start by giving a big shout-out to Jason Offutt (http://jsondata.tumblr.com/) for helping me trouble-shoot this!

First thing you should know…
There are two instances of the Person Quick Search module: One Text Box and Two Text Boxes.  I’m sure you’re reading this saying, “so what!?”  I promise it matters - the code I’m about to show accounts for both instances.

$(function() {
     $("div[id$='pnlOneTextBox']").attr("onkeypress", "");
     $("div[id$='pnlTwoTextBoxes']").attr("onkeypress", "");
     $(document).keypress(function(e) {
         if (e.which === 13) {
             return false;
         return true;

Other than changing the highlighted line above, it’s that simple.  You will need to replace #btnApply with the ID name of your submit button.

Adding this JavaScript before a form will let end-users use the Enter key to submit it.

The use of the Enter key in the Person Quick Search module will also be disabled on whatever page you put this code on.

Leave a Reply