How to avoid page reload on standard action (Save) of Standard Controller ?

Tuesday, April 5, 2016

How to avoid page reload on standard action (Save) of Standard Controller ?


Hello Everyone,

I am going to post something regarding Standard action of Standard controller,
i just came here to post one of my issue with it's solution i hope it is useful....

Problem Statement :

I have created one visualforce page with using standard controller (Opportunity) and it has Two PageBlock, In PageBlock 1 i have two Inputfields and one Button (Standard action Button - SAVE) and this Save button has Standard action named {!Save}, with Pageblock 2 i am using two outfield with the captured values from PageBlock 1 but when i am click on the Save button from PageBlock 1 it will show me the whole Opportunity Detail page (That i don't Need), i want PageBlock 2 with outfield and it has values which are captured from PageBlock 1..

Code of my Issue :

<apex:pageBlockButtons location="Bottom">
                <apex:commandButton value="Save" action="{!Save}" reRender="theForm" status="splashStatus" />
</apex:pageBlockButtons>


This code gives me the whole Opportunity detail page (I don't need whole detail page of opportunity)..


Solution : 


Use Standard action {!quickSave} which is not give you the whole Opportunity detail page, it will reRender the PageBlock 2 which i want to show outfields with captured values from the PageBlock 1.


<apex:pageBlockButtons location="Bottom">
                <apex:commandButton value="Save" action="{!quickSave}" reRender="theForm" status="splashStatus" />
</apex:pageBlockButtons>



I hope this post will help you out...


Thanks :)

No comments: