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.

Vinish Kapoor
Vinish Kapoor

Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 20 years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.

3 Comments

    • Try to disable item after submit and enable it again:

      apex.item("P1_ITEM").disable();
      apex.submit("P1_ITEM");
      apex.item("P1_ITEM").enable();
      
  1. Thank You for Your Help to others....

    How Can I use the "ENTER" key instead of the "Tab" key to move to the next Item in page ?

Comments are closed.