Friday 22 November 2013

Action Function

Action Function:

A component that provides support for invoking controller action methods directly from JavaScript code using an AJAX request.

Action Function Example-

controller:
public class InvokeMethodsController
{
    public String str{set;get;}
    public void funct()
    {
        str= 'This text is displayed after reRendeing';
    }
}


VF page
<apex:page controller="InvokeMethodsController"  >
<apex:form >
    <script>
        function scr()
        {
        alert('hi');
            acFunc();
        }
    
    </script>

    <apex:actionFunction name="acFunc" action="{!funct}"/>

    <apex:inputText id="txt" value="{!str}" onclick="scr();"/>

    </apex:form>

</apex:page>

No comments:

Post a Comment