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
san5augsan5aug 

apex:commandButton : Open a pop-up after proceeding

Hi community,

I have a button on which I want to open a model popup after processing a business logic. While processing I want to show processing image. On this model pop-up, I want show output of business process.

Please help.


AshlekhAshlekh
Hi,

Below code helps you to show a processing image when button will clicked and after completing the action you can cal a javascript to open window dialog. 
<apex:form>
<apex:commandButton value="Call Me" status="statusProcess" action="{!actionA}" oncomplete="Call J-SCriptto open window dilog box" /> 
    <apex:outputPanel id="statusProcessId">
       <apex:actionStatus id="statusProcess">
               <apex:facet name="start">
                   <apex:outputPanel > 
                      &nbsp; Requesting...<img src="/apexpages/devmode/img/saveStatus.gif" />
                   </apex:outputPanel>  
               </apex:facet>
            </apex:actionStatus>
       </apex:outputPanel>

</apex:form>

If  this post helps you and solved you problem then please mark it as solution, ENJOY APEX
dev_sfdc1dev_sfdc1
Hi,

Please refer this links will help you..

https://developer.salesforce.com/forums/ForumsMain?id=906F000000097X9IAI
http://www.salesforcegeneral.com/salesforce-modal-dialog-box/

Thank You.
san5augsan5aug
Thanks Ashlekh Gera (D-Horse) for quick response. Now there is window pop -up. But in this pop -up, I am not able to get updated value of variables, set during actionA function. 


VF Page:

<apex:page controller="TestPage_Controller" > 

 <script type="text/javascript">
       function openWin(){
         alert('{!showPopup}');
       }
</script>

<apex:form id="testForm" > 

<apex:commandButton value="Call Me" status="statusProcess" action="{!actionA}" oncomplete="javascript:openWin();" /> 
    <apex:outputPanel id="statusProcessId">
       <apex:actionStatus id="statusProcess">
               <apex:facet name="start">
                   <apex:outputPanel > 
                      &nbsp; Requesting...<img src="/apexpages/devmode/img/saveStatus.gif" />
                   </apex:outputPanel>  
               </apex:facet>
            </apex:actionStatus>
       </apex:outputPanel>

</apex:form> 
</apex:page>


Here is code for controller.

public class TestPage_Controller {
public double counter {get; set; }
public boolean showPopup {get; set; }
public string teststr {get; set; }
public TestPage_Controller() { }

public pageReference actionA() {
teststr  = 'sandeep';
counter = 0;
showPopup = true;

return null; } }

When I call "showPopup" in javascript, it remains false.

Please help.
AshlekhAshlekh
Hi,

If you want to get updated value in your javascript then there is two ways.

1) Rerender a part so you will get the value.
2) you can pass the value in function where you calling javascript function.

Below code helps you (second way)
<apex:commandButton value="Call Me" status="statusProcess" action="{!actionA}" oncomplete="javascript:openWin('{!showPopup}');" />

And your script function shuold be
<script type="text/javascript">
       function openWin(f){
         alert(f);
       }
</script>

Hope this will helps you please mark it as a solution. ENJOY APEX