Oracle Apex Form Layout with Label above Item.

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

An Oracle Apex Consultant, Oracle ACE, and founder of foxinfotech.in and orclqa.com a question and answer forum for developers.

Leave a Reply

This Post Has 3 Comments

  1. Gus

    hey , how would you avoid multiple enter / submits ? cheers

    1. Vinish Kapoor

      Try to disable item after submit and enable it again:

      apex.item("P1_ITEM").disable();
      apex.submit("P1_ITEM");
      apex.item("P1_ITEM").enable();
      
  2. Ali Xian

    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 ?