Press "Enter" to skip to content

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)
  • 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:

// 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.

Have you found the answer to your question? If not, you can discuss it with me in the comments section below or join my Q&A community OrclQA.com for developers and ask your question. It is FREE.

Vinish Kapoor

Follow

Hi, I am a full stack developer and writing about development. I document everything I learn and help thousands of people. foxinfotech.in is created, written, and maintained by me; it is built on WordPress, and hosted by Bluehost. Connect with me on Facebook, Twitter, GitHub, and get notifications for new posts.

guest
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments