Sunday 23 November 2014

Visualforce Actionsupport examples



<apex:page controller="actionSupport6">
  <apex:form >
      <apex:outputPanel id="test">
          <apex:pageBlock >
              Enter Text1:<apex:inputText value="{!text1}"/>
                            <br/><br/><br/><br/>
            
              Enter Text2:<apex:inputText value="{!text2}">
                                <apex:actionSupport event="onmouseover" action="{!CallMethod}" reRender="test"/>
                          </apex:inputText>
          </apex:pageBlock>
      </apex:outputPanel>
  </apex:form>
</apex:page>


public class actionSupport6
{

    public String text1{get;set;}
    public String text2{get;set;}
    
    public void CallMethod()
    {
       
        text2 = text1;
    } 
}


===============================================================





<apex:page standardController="Contact" extensions="ActionSupport">
    <apex:form>
        <apex:pageBlock>
            <apex:pageBlockSection id="appraiserInfo">
                <apex:inputField value="{!Contact.firstname}"/>

               </apex:pageBlockSection>
                 <apex:inputField label="Company" value="{!contact.AccountId}">
                      <apex:actionSupport action="{!UpdateContactDetails}"  event="onchange" rerender="appraiserInfo" />
                  </apex:inputField>
        </apex:pageBlock>
    </apex:form>
 
</apex:page>

===========================================================

public class ActionSupport {

    public contact conObj;
    public ActionSupport(ApexPages.StandardController controller)
    {
        conObj=(Contact)controller.getRecord();
    }
    public void UpdateContactDetails()
    {
        system.debug('Method is Calling with id===>'+conObj.Accountid);
       
        Account Varacc=[select id,name from Account where id=:conObj.Accountid];
        conObj.firstname=Varacc.name;
    }

}


No comments:

Post a Comment

Complete Salesforce CPQ training Free videos

Salesforcestart:: We are excited to announce that our YouTube channel, Salesforcestart, is your one-stop-shop for all things Salesforce CPQ!...