Skip to Main Content
Feature Request FR-2978
Product Area Page Components
Status CLOSED

4 Voters

Prevent page submission when there is a single page item on the page and "Submit when Enter pressed" is turned off

ej egyed Public
· Feb 15 2023

Idea Summary
When a page is created that has only one page item, the Submit when Enter pressed property does not function as expected for that page item. With the property is turned off, the page will still submit even if the developer has designated that it should not.

Use Case
As a workaround, developers need to either add custom JavaScript to the page or a dummy hidden page item (so that there are 2 on the page) so that the page does not submit when enter is pressed.

After speaking with Oracle Support, they have said that it is not a bug and that the HTML spec is being followed. But they have also provided a workaround that should not be necessary if the setting worked properly for a single page item on a page.

Oracle Support Recommendation:

Add a dynamic action "Prevent Enter Key" for this page item with the following settings:

Event = Key Press
Client Side Condition - Type = JavaScript
JavaScript Expression = this.browserEvent.keyCode===13

Preferred Solution (Optional)
No changes need to be made to the page designer, the declarative option that already exists should just work. During rendering of the page, if APEX sees the page only has one item and the Submit when Enter pressed property is turned off, HTML/JavaScript should be added to the page to prevent the page submitting when the item is focused on the page and Enter is pressed.

Other blog posts on the same topic

http://deneskubicek.blogspot.com/2008/06/textfield-item-submiting-page.html
https://blog.jaris.fi/apex/f?p=BLOG:READ:::NO::ARTICLE:2525800346147859
 

I have created a sample application on apex.oracle.com that demonstrates the issue:

We reviewed this idea carefully, and while it was interesting, we concluded that due to all the internal implications we need to take into account, it is unlikely to make its way into APEX.

Comments

Comments

  • jayson hanes Admin OP 2.4 years ago

    yup, I always have to create a dummy item that is u-hidden to prevent this. However, I don't see this being added to APEX as it would in fact break the HTML spec..

  • ej egyed OP 2.4 years ago

    I do not think that it needs to break the HTML spec. JavaScript can be used to allow page submission or not. The way that it currently functions, the “Submit when Enter pressed” setting is useless when it is just one page item on the page.