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
Swamy P R NSwamy P R N 

How to stop to refresh the page after done with the "Action" method, Is any forcestop to refresh the page?

Hello Folks,

I was facing an issue with my loading  of visualforce page. I have executed the javascript, from the javascript iam executing action method. After executing that action method, again my page is reloading but i just want to stop after execution of action method.

In the end of my action method the below code is executing correctly::
if(prdctsWithQuantity.size()>0){
              currentStep='2';  
 }

VF Page:
<script type="text/javascript">
        function showRelatedProducts(slctrcrd){
             var eterm=document.getElementById('{!$Component.frm:pb0:pblksctn:pbsitm:pfmly}').value;
              if(eterm=='')
              {
                  alert('You have to Select Product Family');
              }
              else{
                     callprdcts();
              }
    }
</script>
  <apex:actionFunction action="{!showSelectedProductFamilyRecords}" name="callprdcts" reRender="frm"/>

Actually it is showing the second step page, but again coming back to first step page. How to stop after the above logic execution..

Suggest me, Thanks in advance !!
sandeep sankhlasandeep sankhla
Hi 

Please share your entire code here...class code as well...

thanks,
Sandeep
Pavan AnnaldasPavan Annaldas
Hi Swamy,

Use reRender = "false",

<apex:actionFunction action="{!showSelectedProductFamilyRecords}" name="callprdcts" reRender="false"/>
Swamy P R NSwamy P R N
Hi Sandeep,

Earlier it used to show second section and it come back to first section. This time even it is not showing secoond section after clicking the button on first page.
Swamy P R NSwamy P R N
<!-- First Section -->
<apex:outputPanel rendered="{!step='1'}">
           <apex:pageBlock mode="edit" id="pb0" title="Step1. Selecting product family and Primary Contact">
           <apex:pagemessages escape="false"></apex:pagemessages>
               <apex:pageBlockSection columns="1" showHeader="false" id="pblksctn">
                <apex:pageBlockSectionItem id="pbsitm">
                    <apex:outputLabel value="Product Family" for="pfamily"/>
                        <apex:selectList size="1" value="{!productFamily}" id="pfmly">
                        <apex:selectOptions value="{!Options}"/>
                    </apex:selectList>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            <apex:pageblockTable value="{!cntctList}" var="cnt" id="pblck1">
                <apex:column headerValue="Select">
                    <apex:inputCheckbox value="{!cnt.isSelected}" id="slctdrcrd"/>
                </apex:column>
                <apex:column headerValue="Name">
                    <apex:outPutLink value="/{!cnt.cnt.id}" target="_new">{!cnt.cnt.Name}</apex:outPutLink>
                </apex:column>
                <apex:column value="{!cnt.cnt.Email}"/>
            </apex:pageblockTable>
            <apex:commandButton value="Next"   onclick="return showRelatedProducts('{!$Component.slctdrcrd}');"  />
        </apex:pageBlock>
        </apex:outputPanel>

        <!-------- Second Section -------->
         <apex:pageBlock mode="edit" id="pb1" title="Step2. Select Max of 5 Products" rendered="{!step='2'}">
         <apex:pagemessages escape="false"></apex:pagemessages>
            <apex:pageBlockTable value="{!prdctsWithQuantity}" var="pwq">
                <apex:column headerValue="Select">
                    <apex:inputCheckbox value="{!pwq.checked}"/>
                </apex:column>
                <apex:column value="{!pwq.prdcts.Name}" headerValue="Product Name"/>
            </apex:pageBlockTable>
            <apex:commandButton value="Cancel" action="{!removeOpportunityAndQuote}" style="margin-left:50px;"/>
            <apex:commandButton value="Next" action="{!selectedPrdcts}" reRender="frm" status="SearchLoadingstatus" style="margin-left:10px;"/>
         </apex:pageBlock>
I just pasted the VF Page code here, among these javascript and actionfunction posted in the top of the page.

If possible, please have a look on it and update me..

Thanks.
shubham lathoriyashubham lathoriya
Try using button tag,hope this will help