I am confused by five tags in visualforce. apex:actionFunction, apex:actionPoller, apex:actionStatus, apex:actionRegion and apex:actionSupport. Could you please explain them to me.

1 Answer 1


Before we start - you have 2 methods for calling Apex functions (I mean real functions that do something, not getters/setters): apex:commandButton, apex:commandLink. But sometimes you need more.

actionFunction is for exposing a server-side method (apex call) as something you can call from JavaScript. Maybe you don't want a button or link because their styles are boring, you want something to happen when user clicks an image, expands a section of text. Maybe you want to have some client-side validations to happen before you actually let the call go through.

actionPoller is useful when you have some long-running server-side action. All these methods would give you a callback / reload the page eventually on success but it sometimes you need more. Do you have situations when you need to call "is it done yet?". Maybe user clicks a button to submit a long batch - normal users can't go to Setup -> Apex Jobs but they'd appreciate a kind of progress bar that 20% of records have been processed so far. Maybe you'd have callouts run from apex. Maybe you need a "poor man's batch job" - VF page that has N records, can process say only 10 at a time so you'll be using poller to check if it's done / submit next chunk of work. I'm saying "poor man's batch" because it'd break if you navigate away from the page when it's unfinished.

actionStatus is useful for showing a spinning wheel "Loading...", "Submitting..." or any kind of indication to user that we're waiting, there's no need to click the button again. Actually I like to abuse this tag a bit to disable the buttons but that's bit of personal preference. Check https://salesforce.stackexchange.com/a/194195/799

actionRegion is good for submitting only part of the whole <apex:form>. Region determines which input fields get submitted, not what to rerender! It's a slight speed increase, useful if you're building something like an autocomplete (without any JavaScript... hey, not the best idea but doable). It comes handy if you have some required fields on the form to be filled later for example, they're blank but user really wants to run some search... Submitting whole form would immediately slap you with "this field is required, sucks to be you". Region lets you work around that by not including these fields. https://salesforce.stackexchange.com/a/22216/799 - big example, sorry.

actionSupport is kind of similar to 1st one, actionFunction. What if you need something special to happen on clicking the image / normal paragraph of text etc (not a standard commandButton/link but maybe a carefully created shiny regular <button> tag?). This tag will enhance any other tag, wiring say an onClick event to it. You could do same with actionFunction but you'd have to write a bit more. If that event attaching is all you need - use actionSupport. If you really need to make the call happen from JavaScript (maybe some complex validations, maybe it has to be called from some other JS library like jQueryUI modal box) - use actionFunction.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .