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
rock krishrock krish 

any one please send me the all Action Components with examples...and any video tutorails from youtube or salesforce.com ?

Vasani ParthVasani Parth
Rock,

Here is the link to the blog (http://www.crmsalesforcetraining.com/different-visualforce-action-components/)

Please mark this as the best answer if this helps
SandhyaSandhya (Salesforce Developers) 
Hi Rock,

There are four types of Action components in visual force which allows different actions to run in the background and can be used to refresh the page partially.

1.Action function: used to call the server side method using JavaScript
 
Explanation:-
----------------
ActionFunction: provides support for invoking controller action methods directly from JavaScript code using an AJAXrequest
 
It is Used when we need to perform a similar action on various events. Even though you can use it in place of actionSupport as well where the only event is related to only one control.
 
ActionFunction provides support for invoking controller action methods directly from JavaScript code using an AJAXrequest.
 
<!-- Page: -->
<apex:page controller="exampleCon">
<apex:form>
<!-- Define the JavaScript function sayHello-->
<apex:actionFunction name="sayHello" action="{!sayHello}" rerender="out"
status="myStatus"/>
</apex:form>
<apex:outputPanel id="out">
<apex:outputText value="Hello "/>
<apex:actionStatus startText="requesting..." id="myStatus">
<apex:facet name="stop">{!username}</apex:facet>
</apex:actionStatus>
</apex:outputPanel>
<!-- Call the sayHello JavaScript function using a script element-->
<script>window.setTimeout(sayHello,2000)</script>
<p><apex:outputText value="Clicked? {!state}" id="showstate" /></p>
<!-- Add the onclick event listener to a panel. When clicked, the panel triggers
the methodOneInJavascript actionFunction with a param -->
<apex:outputPanel onclick="methodOneInJavascript('Yes!')" styleClass="btn">
Click Me
</apex:outputPanel>
<apex:form>
<apex:actionFunction action="{!methodOne}" name="methodOneInJavascript"
rerender="showstate">
<apex:param name="firstParam" assignTo="{!state}" value="" />
</apex:actionFunction>
</apex:form>
</apex:page>

controller
-------------
public class exampleCon {
String uname;
public String getUsername() {
return uname;
}
public PageReference sayHello() {
uname = UserInfo.getName();
return null;
}
public void setState(String n) {
state = n;
}
public String getState() {
return state;
}
public PageReference methodOne() {
return null;
}
private String state = 'no';
}

 
 

2.Action poller: Used to call the server side method in a regular interval of time.


ActionPolor: A timer that sends an AJAX update request to the server according to a time interval that you specify. The update request can then result in a full or partial page update. You should avoid using this component with enhanced lists.

 
<!-- Page -->
<apex:page controller="exampleCon">
<apex:form>
<apex:outputText value="Watch this counter: {!count}" id="counter"/>
<apex:actionPoller action="{!incrementCounter}" rerender="counter" interval="15"/>
</apex:form>
</apex:page>

public class exampleCon {
Integer count = 0;
public PageReference incrementCounter() {
count++;
return null;
}


 

3.Action support: Used to call the server based on the client side event i.e. like on click, on ActionSupport:..e, etc

 A component that adds AJAX support to another component, allowing the component to be refreshed asynchronously by theserver when a particular event occurs, such as a button click or mouseover.

Used when we want to perform an action on a perticular eventof any control like onchange of any text box or picklist.
 
<!-- Page: -->
<apex:page controller="exampleCon">
<apex:form>
<apex:outputpanel id="counter">
<apex:outputText value="Click Me!: {!count}"/>
<apex:actionSupport event="onclick"
action="{!incrementCounter}"
rerender="counter" status="counterStatus"/>
</apex:outputpanel>
<apex:actionStatus id="counterStatus"
startText=" (incrementing...)"
stopText=" (done)"/>
</apex:form>
</apex:page>
 
public class exampleCon {
Integer count = 0;
public PageReference incrementCounter() {
count++;
return null;
}
public Integer getCount() {
return count;
}
}

 

4.Action status:A component that displays the status of an AJAX update request. An AJAX request can either be in progress or complete.


actionStatus visualforce component displays the status of an AJAX update request. An AJAX request can either be in progress or complete.

Depending upon the AJAX request status (whether AJAX request is in progress or complete), this component will display different message to user. In many scenarios AJAX request takes some time. So we should display some message to user that your request is in progress. Once request is complete, we can display some different message to user.
 
<apex:page controller="exampleCon">
<apex:form >
<apex:outputText value="Watch this counter: {!count}" id="counter"/>
<apex:actionStatus startText=" (incrementing…)" stopText=" (done)" id="counterStatus" />
<apex:actionPoller action="{!incrementCounter}" rerender="counter" status="counterStatus" interval="05"/>
</apex:form>
</apex:page>


controller
-----------------
 
public class exampleCon {
Integer count = 0;

public PageReference incrementCounter() {
count++;
return null;
}

public Integer getCount() {
return count;
}
}

Please accept my solution as Best Answer if my answer was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
 
Thanks and Regards
Sandhya


 
SandhyaSandhya (Salesforce Developers) 
Hi Rock,

Please see below link which has all videos regarding visualforce.

http://meta-guide.com/videography/100-best-visualforce-videos
 
Hope this helps you.
 
Please mark it as solved if this helps you.
 
Thanks and Regards
sandhya