How can you detect the enter key being pressed in any text input field?

By | April 4, 2009

Want to trap the Enter key press event and have it click a button for you?

Consider the search engine in the standard Sage CRM. Generally we all people use standard find screens for searching the cases, company, person and opportunity records respectively. In the standard search screens, suppose user wants to search all those companies which start from text “ABC”. To achieve the same what user will need to do that he will enter the value “ABC” in the Company Name text box and then just press the Enter Key, the results will be displayed. In this situation user does not need to click on Find Button to search the records.

But how it will be possible with the custom find screens? In the custom find screens user have to click on the Find button after entering value in any text box. It is a pain when you have to grab the mouse and move the cursor to the Find button and click it.

Solution:

You can achieve the same with the couple of JavaScript statements given below.(click the image to enlarge it)