+ Start a Discussion
sfdotcomsfdotcom 

Lightning Component for action support functionality

Hi,

I am new to lightning components. Could you please help me on achieving the actionSupport functionality in lightningcomponents.
Requirement: 
If Account Type is "Prospect" then Description will be displayed.
If Account Type is "Customer - Direct" then "Phone" field should be required.

Here is the visualforce page for above requirement. I want the same functionality using Lightning Components. Thanks in Advance.
<apex:page standardController="Account"  >
    <apex:sectionHeader title="Account" subtitle="Edit Page" />
    <apex:form>
        <apex:pageBlock title="Account Information" mode="mainDetail">
            <apex:pageBlockButtons>
                <apex:commandButton value="Save" action="{!save}" />
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection title="Info">
                <apex:inputField value="{!Account.Name}" />
                <apex:pageBlockSectionItem>
                    <apex:outputLabel> Account Type</apex:outputLabel>
                    <apex:actionRegion>
                        <apex:inputField value="{!Account.Type}" >
                            <apex:actionSupport event="onchange" reRender="showDescription" />
                        </apex:inputField>
                    </apex:actionRegion>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Details" id="showDescription"  >
                <apex:inputField value="{!Account.Description}" rendered="{!Account.Type=='Prospect'}" />
                <apex:inputField value="{!Account.Phone}" required="{!Account.Type=='Customer - Direct'}" />
            </apex:pageBlockSection>
        </apex:pageBlock>
      </apex:form>
</apex:page>


Thank You.
James LoghryJames Loghry
It sounds like you have a ways to go before you can implement this as a Lightning Component. I'd suggest going through the "Lightning Component Basics" module on Trailhead to get a better understanding of how components work: https://developer.salesforce.com/trailhead/module/lex_dev_lc_basics.

After you take a first stab at your new Lightning Component, post back here with any specific questions you may have and we'd be glad to help.