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
Ananga Sen 13Ananga Sen 13 

ENTER button is not working in VF page.

issue:
While creating a New Opportunity, if user is pressing the “Enter” key, then the record is not getting save. Afer clicked on ENTER its redirecting to the opportunity list view page.
My expectation:
After all data entry in the new opportunity VF page if user click on ENTER button then the data should save and details page should open.
What is the issue on the VF page? Why ENTER button not working?

 
SandhyaSandhya (Salesforce Developers) 
Hi,

Refer below document which has the solution for the same.

https://developer.secure.force.com/cookbook/recipe/submit-a-form-with-the-enter-key
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya
 
suriya deepaksuriya deepak
Hi  Ananga ,

Juz try the below code in  pageblockButtons 

<apex:commandButton value="enter" action="{!save}"/>

You have to give action for your button . if you want customize more than this , then you should go for controller class . juz try the above code . if it s useful just mark it as correct answer.

thanks 
suriya
Sai harsha 7Sai harsha 7
Hi Ananga
You can try this code . It will help you definetly

<apex:commandButton value="Enter" action={!redirectspage}/>

In the controller

public pageReference redirectspage()
{
     insert opp; // inserting the new opportunity record 
  
   pageReference pg = new pageReference('/'+opp.id);
   pg.setRedirect(true);

     return pg;
}

please mark it as Best Answer and solved.

Thanks 

Sai harsha