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
Lokeswara ReddyLokeswara Reddy 

How to control command buttons when 'Enter' button clicked

Hi All,

There a VF page to search on Accounts, the page has 'Search' and 'Cancle' buttons, after filling data in search field and if you click 'Enter' button it won't work, the user has to click manually on 'Search' button, when clicked it reloads the page and shows progress bar till the resulsts displayed. 
Now there is a new requirement to have a new button 'Create New Account' in the VF page to redirect to new Account edit page by copying the data from search fields, Every thing works fine, but if user clicks 'Enter' button after filling search fields by defaults it takes the user to New account page!
Is there any way that we can controle this? on 'Enter' click it should invoke 'Search' button else NO action,

<apex:commandButton action="{!search}" value="Search" id="SearchBt" status="processingStatus" reRender="resultPanel,errorPanel"/>
<!--  <apex:commandButton action="{!search}" value="Search"/> -->
<apex:commandButton action="{!reset}" value="Reset" status="processingStatus" reRender="resultPanel,errorPanel,searchPanel"/>
<apex:commandButton action="{!redirectToNewAccountPG}" value="Create New Account"/>

I have tried Line#2, the Enter button has invoked 'Search' button, but it did not show the search bar and more over it reloads entier page and not just the search results.

Any thoughts on this? Thanks in advanc

Lokesh...