function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Pressing Enter - causes record to close/save - how to stop.

I have a visualforce page.


It has four buttons on it:





and in a section which has a few free text fields





Essentially it is a custom designed search function which adds contacts to a record based on the parameters placed in the free text fields.


The issue is, you need to press the search button to search. The natural thing to do is to enter your search term and press enter. This is either closing or saving the record. Once the user presses back to get back to the search screen, it actually causes a new record to be saved when they complete. The result being that lots of empty records get created.


Of course user education is one thing, but is there a way to make the focus shift from Save or Close down to Search?




Do a web search on 'visualforce enter focus' for various solutions to this


One technique I have used is this one -


Thanks, I'll have a go.