actionStatus tag in visualforce
<apex:actionStatus> tag
This tag helps you to display the status AJAX request like an AJAX request can either be in progress.
See the below example to understand <apex:actionstatus> tag.
Below visualforce helps you to search opportunity based on name:
<apex:page controller=”OppsearchController”>
<apex:form >
<apex:pageBlock id=”pb” mode=”edit”>
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel for=”Search String”>Search String</apex:outputLabel>
<apex:panelGroup >
<apex:inputText value=”{!searchString}”/>
<apex:commandButton value=”GO” action=”{!oppResult}” status=”as” reRender=”pbt”/>
<apex:actionStatus startText=”Searching…….” id=”as”></apex:actionStatus>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title=”Result”>
<apex:pageBlockTable value=”{!OppSearchResult}” var=”opp” id=”pbt”>
<apex:column value=”{!opp.name}”/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
<apex:form >
<apex:pageBlock id=”pb” mode=”edit”>
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel for=”Search String”>Search String</apex:outputLabel>
<apex:panelGroup >
<apex:inputText value=”{!searchString}”/>
<apex:commandButton value=”GO” action=”{!oppResult}” status=”as” reRender=”pbt”/>
<apex:actionStatus startText=”Searching…….” id=”as”></apex:actionStatus>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title=”Result”>
<apex:pageBlockTable value=”{!OppSearchResult}” var=”opp” id=”pbt”>
<apex:column value=”{!opp.name}”/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Apex Controller:
public class OppsearchController {
List<Opportunity> OppSearchResult;
public String searchString { get; set; }
public List<Opportunity> getOppSearchResult() {
return OppSearchResult;
}
public PageReference oppResult() {
OppSearchResult = (List<Opportunity>)[FIND :searchString RETURNING Opportunity(Name)][0];
return null;
}
}
List<Opportunity> OppSearchResult;
public String searchString { get; set; }
public List<Opportunity> getOppSearchResult() {
return OppSearchResult;
}
public PageReference oppResult() {
OppSearchResult = (List<Opportunity>)[FIND :searchString RETURNING Opportunity(Name)][0];
return null;
}
}
See the below visualforce page output.

In the above screen, when you click on Go button, it will get the record and will status as you defined in actionstatus tag.
Post a Comment