+ 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::

VF Page:
<script type="text/javascript">
        function showRelatedProducts(slctrcrd){
             var eterm=document.getElementById('{!$Component.frm:pb0:pblksctn:pbsitm:pfmly}').value;
                  alert('You have to Select Product Family');
  <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

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

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:pageblockTable value="{!cntctList}" var="cnt" id="pblck1">
                <apex:column headerValue="Select">
                    <apex:inputCheckbox value="{!cnt.isSelected}" id="slctdrcrd"/>
                <apex:column headerValue="Name">
                    <apex:outPutLink value="/{!cnt.cnt.id}" target="_new">{!cnt.cnt.Name}</apex:outPutLink>
                <apex:column value="{!cnt.cnt.Email}"/>
            <apex:commandButton value="Next"   onclick="return showRelatedProducts('{!$Component.slctdrcrd}');"  />

        <!-------- 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 value="{!pwq.prdcts.Name}" headerValue="Product Name"/>
            <apex:commandButton value="Cancel" action="{!removeOpportunityAndQuote}" style="margin-left:50px;"/>
            <apex:commandButton value="Next" action="{!selectedPrdcts}" reRender="frm" status="SearchLoadingstatus" style="margin-left:10px;"/>
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..

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