Please check the below sample code for action poller and action region. Action Poller Example:
VisualForce page:
<apex:page controller="ActionpollarClass">
<apex:form >
<apex:pageBlock id="payment">
<apex:actionPoller action="{!movepayment}" reRender="payment" interval="5" status="status" enabled="{!paymentstate!='complete'}"/>
<apex:outputPanel id="payment">
The state of your payment mode is
<apex:outputText style="font-weight:bold" value="{!paymentstate}">
</apex:outputText>
</apex:outputPanel>
<br/>
<apex:actionStatus startText="pooling..." id="status"></apex:actionStatus>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public with sharing class ActionpollarClass {
public String complete { get; set; }
public list<string> states=new list<string>{'Connecting to bank','Authorising','Authotized','complete'};
//index of the currentstate
private integer stateIdx=0;
//getter to reterive the current state
public String getPaymentstate() {
return states[stateIdx];
}
//action method invoked by the pooer increments the current state index
public PageReference movepayment() {
stateIdx++;
return null;
}
}
Action Region Example:
Please refer the below link for example of "Action region"
Please check the below sample code for action poller and action region. Action Poller Example:
VisualForce page:
<apex:page controller="ActionpollarClass">
<apex:form >
<apex:pageBlock id="payment">
<apex:actionPoller action="{!movepayment}" reRender="payment" interval="5" status="status" enabled="{!paymentstate!='complete'}"/>
<apex:outputPanel id="payment">
The state of your payment mode is
<apex:outputText style="font-weight:bold" value="{!paymentstate}">
</apex:outputText>
</apex:outputPanel>
<br/>
<apex:actionStatus startText="pooling..." id="status"></apex:actionStatus>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public with sharing class ActionpollarClass {
public String complete { get; set; }
public list<string> states=new list<string>{'Connecting to bank','Authorising','Authotized','complete'};
//index of the currentstate
private integer stateIdx=0;
//getter to reterive the current state
public String getPaymentstate() {
return states[stateIdx];
}
//action method invoked by the pooer increments the current state index
public PageReference movepayment() {
stateIdx++;
return null;
}
}
Action Region Example:
Please refer the below link for example of "Action region"
Please check the below sample code for action poller and action region.
Action Poller Example:
VisualForce page:
Controller:
Action Region Example:
Please refer the below link for example of "Action region"
http://www.sfdcpoint.com/salesforce/actionregion-visualforce-salesforce/
Hope this helps you!
Best Regards,
Jyothsna
All Answers
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionRegion.htm
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_actionPoller.htm
http://www.cloudforce4u.com/2013/06/difference-between-action-support-and.html
http://sfdcsrini.blogspot.com/2014/07/visualforce-action-region-example.html
http://www.sfdcpoint.com/salesforce/actionpoller-visualforce-salesforce/
Please check the below sample code for action poller and action region.
Action Poller Example:
VisualForce page:
Controller:
Action Region Example:
Please refer the below link for example of "Action region"
http://www.sfdcpoint.com/salesforce/actionregion-visualforce-salesforce/
Hope this helps you!
Best Regards,
Jyothsna