Oracle Apex: Submit Page When Enter Key Pressed

In Oracle Apex, there is an option (a property setting) for the Text Field item, where you can define to submit the page when enter key pressed. But for the items such as Numeric Field and Popup LOV , there is no such option.

So if you want to submit the page when the user presses the enter key for the Numeric and Popup LOV fields, follow these steps:

Create a Dynamic Action

Create a dynamic action on that page item and set the following properties:

Event: KeyDown

Selection Type: Items(s)

Item: P3_MY_PAGE_ITEM (your page item on which you want to submit the page when enter key pressed)

(your page item on which you want to submit the page when enter key pressed) Client-Side Condition > Type: Item is not null (you can skip this setting if you want to submit even if the item value is null)

Item: P3_MY_PAGE_ITEM

Create a True Action

Create a True action for the above dynamic action and set the following properties:

Action: Execute JavaScript Code

JavaScript Code: Add the following code in it:

// check if enter key pressed if(event.which == 13) { // specify your page item apex.submit('P3_MY_PAGE_ITEM'); }

The ASCII code for the enter key is 13, so the above JavaScript code will check the last key pressed and if it is the enter key, then will call the method apex.submit() to submit the page.

Save the changes and run the page to test. Now when the user will enter any value and presses the enter key, it will submit the page.