Follow Us on Twitter

Catching key strokes using Dynamic Actions in Oracle APEX 4.x

by Michel van Zoest on January 28, 2014 · 2 comments

One of the demands for a customer application built in Oracle Application Express was, that a part of the application could be completely operated by the numpad of a keyboard. This had to do with the physical aspects of one of the workstations. There was simply not enough room for a full keyboard.

When building an APEX application, you have several tools to your disposal to allow this. First of all there is the option “Submit when ENTER pressed” on text items that removes the need for buttons to submit a page.

Next there are some built in possibilities in Dynamic Actions. For example; there is the True Action setFocus that allows a developer to automatically put the focus on a certain item (for example the item that submits when ENTER pressed) in case of an event (like Page Load). With these two you can already build a simple page to navigate through the pages of your application.

One more demand was for a certain page to scroll back and forth using the plus(+) and minus(-) keys on the numpad. This also is relatively easy to do in APEX. It requires a Dynamic Action and one line of JavaScript.

Here are the steps to take when catching the plus(+) key stroke.

  • First create a new Dynamic Action
  • The event should be ‘Key Release’
  • As Item select one of the items on your page
  • Add a condition of type “JavaScript expression”
  • The value of this condition is “this.browserEvent.which === 107” (107 is the plus(+) key, 109 is the minus(-) key)
  • Add an action to perform on this event, like an alert.

And that’s it!

The result should look like the following screenshot:

Key Release Dynamic Action ALT

Key Release Dynamic Action

Catching key strokes using Dynamic Actions in Oracle APEX 4.x, 4.6 out of 5 based on 7 ratings
VN:D [1.9.22_1171]
Rating: 4.6/5 (7 votes cast)

{ 2 comments… read them below or add one }

Patrick Sinke February 6, 2014 at 2:56 pm

You did it! Great job 🙂


mohamed February 14, 2020 at 3:58 pm

How Can I Add Another Condition To his Condition
I Mean That i Need To Add (and :item1 = 2) to
this.browserEvent.which === 13

How Can I Write It In Java Script ?


Leave a Comment


Previous post:

Next post:

About Whitehorses
Company profile

Whitehorses website

Home page

Follow us
Blog post RSS
Comment RSS