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
SFDCkumarSFDCkumar 

Viewstate issue.Page is not getting reload.

Hi guys,

 

i am experiencing different kind of issue when trying to reload the current page. i am telling u my requirement in very brief..

 

I have two Buttons  "SAVE" and "QUICKSAVE",only difference between both is when user hit SAVE button it will be redirected to details page of record but when user hit QUICKSAVE button it needs to be redirected to current page.After first QUICKSAVE button hit, data are getting saved and system are redirecting User to current page , but when user are hitting QUICKSAVE button again, Insted of current page blank page is getting appeared  but data are getting saved correctly.

it seems issue is related to view state but i am not getting how to get rid off. In debug Log below URL are being generated:-

 

https://c.cs11.visual.force.com/apex/ManageShow?com.salesforce.visualforce
.ViewStateCSRF=..U1trDVlHl9qkwbs9Xb9y2.X3uiMN8JgaDnTHQdrTH_ciJqwoZLH.ufo6a
3ylGlcPPPLNBP7sPUpWkX9O9jUlDwyS8I6Lbsz0ovy2pM9hIi5Pg_rxlhauabl1JabyU_9_wO4
Lf1KFEkSH8IxEebBaAzgNI%3D&core.apexpages.devmode.url=1&j_id0%3AShowBuilder
Form=j_id0%3AShowBuilderForm&j_id0%3AShowBuilderForm%3AshowBuilderPbBlock%3
AartistFilterSection%3Aj_id46%3Aj_id49=selectone&j_id0%3AShowBuilderForm%3A
showBuilderPbBlock%3AartistsPbSection%3AartistTable%3A0%3Aj_id55=on&j_id0%3
AShowBuilderForm%3AshowBuilderPbBlock%3AartistsPbSection%3AartistTable%3A0%3
Aj_id65=80000.0&j_id0%3AShowBuilderForm%3AshowBuilderPbBlock%3AartistsPbSect
ion%3AartistTable%3A1%3Aj_id65=1500.0&j_id0%3AShowBuilderForm%3AshowBuilder
PbBlock%3AcbButtons%3AquicksaveBtn=QuickSave&j_id0%3AShowBuilderForm%3Ashow
BuilderPbBlock%3AmanageShowPbSection%3Aj_id36=Hyd_infosysshow3&j_id0%3AShow
BuilderForm%3AshowBuilderPbBlock%3AmanageShowPbSection%3Aj_id37=Kukatpully&
j_id0%3AShowBuilderForm%3AshowBuilderPbBlock%3AmanageShowPbSection%3Aj_id
37_lkid=a0DZ000000BnvRp&j_id0%3AShowBuilderForm%3AshowBuilderPbBlock%3Amana
geShowPbSection%3Aj_id37_lkold=Kukatpully&j_id0%3AShowBuilderForm%3AshowBuil
derPbBlock%3AmanageShowPbSection%3Aj_id37_lktp=a0D&j_id0%3AShowBuilderForm%3
AshowBuilderPbBlock%3AmanageShowPbSection%3Aj_id37_lspf=0&j_id0%3AShowBuilder
Form%3AshowBuilderPbBlock%3AmanageShowPbSection%3Aj_id37_lspfsub=0&j_id0%3ASho
wBuilderForm%3AshowBuilderPbBlock%3AmanageShowPbSection%3Aj_id37_mod=0&j_id0%3
AShowBuilderForm%3AshowBuilderPbBlock%3AmanageShowPbSection%3Aj_id38=10%2F16%2
F2012+6%3A53+AM&j_id0%3AShowBuilderForm%3AshowBuilderPbBlock%3AmanageShowPbSect
ion%3Aj_id39=Alternative&j_id0%3AShowBuilderForm%3AshowBuilderPbBlock%3AmanageShowPbSection%3Aj_id40=Proposed

 

 


My visual force code which are invoking controller extension method:-

           

<apex:pageBlockButtons id="cbButtons">
                <apex:commandButton action="{!saveShowAndPerformance}" value="Save" id="saveBtn" status="savingStatus" reRender="hiddenBlock">
                    <apex:param name="saveId" value="{!showobj.Id}" assignTo="{!savepage }" />
                </apex:commandButton>
                
                <apex:commandButton action="{!saveShowAndPerformance}" value="QuickSave" id="quicksaveBtn" status="savingStatus,ShowBuilderForm" />

                <apex:commandButton action="{!cancel}" value="Cancel" immediate="true" />
            </apex:pageBlockButtons>

 

 

My Controller extension method where i am setting the Page reference:-

 

 public PageReference saveAndquicksaveaction() {

      //.................. DML operation code here..............
          
         

   //Below are the page reference Code.

             PageReference showDetailPage;   
            if(ApexPages.currentPage().getParameters().get('saveId')!= null) {
               // Return on the object detail Page.
               showDetailPage = new ApexPages.StandardController(showobj).view();
                 showDetailPage.setRedirect(true);
            }else{
               // Return on the object entry  visualforce Page.
                 showDetailPage = new PageReference(System.currentPageReference().getUrl());
                 showDetailPage.setRedirect(true);
               //  system.debug('@@@@@Save button++++++'+ApexPages.currentPage().getParameters().get('saveId'));
           }     
        return showDetailPage;    
     }

 

 

Guys,Please help me out......Eagerly waiting for your response......

 

Thanks,

Hengky IlawanHengky Ilawan

Hi,

 

You can use "return null" if you want to stay at the same page.

 

Regards,

Hengky