Monday, 23 April 2007

Stop Page Submission When Enter is Pressed

If you have an HTML page containing only 1 Textbox, standard HTML / browser behavior is to allow the page to be submitted when entered is pressed.

Normally I don't have an issue with this but in APEX, no request value is picked up when the page is submitted this way. Consequently, you usually get an error implying there is no page to branch to as the page was submitted without a request value.

The solution to this problem is very simple.

Create a dummy textbox on the page and in the: HTML Form Element Attributes attribute, enter the following: style="display:none;"

Now because the browser thinks 2 textboxes exist, page submission by pressing enter will not occur.

Simple solution to a small but annoying problem


Mike Saunt said...

Thanks Duncan

worked for me


Omar said...

Thanks Dunkan,
It tried it in IE, it worked fine, but in FF did not work any ideas.