Sunday, 29 June 2008

Textfield Item - Submitting the Page

Normaly, if there are page items of type "Text Field" they will not submit the page unless you change them to "Text Field (always submits page when Enter pressed)". If you have only one item on you page of type "Text Field" this behaviour changes and the page will always submit if you press "Enter". Sometimes, you don't want this to happen. Especially, if you have some javascript attached to your field. To avoid that you can use the following trick:

1. create another item on you page of type "Text Field",

2. in the "HTML Form Element Attributes" of that item put


The result is that the second item will not be displayed and the first item will not submit on pressing "Enter".


Christine Wergowski said...

Now I finally know why some of my text fields do a submit without that I have told them to do so.

Thanks for the hint :).

Apex Rookie User said...

Very nice topic! I was having some headaches because this, thanks a lot!!

Sydney said...

Thanks Denes,

I had a one-item page (for updating) and using a barcode-scanner for input. It always 'generated' a press Enter without me submitting. Your 'trick' works fine!

Bekah said...

Apparently in apex this is still an issue. Thank you for your help!