3

I am making an component in lightning. i want to know how can we use the state and county picklist in this particular code. secoundly the functionality of save and cancel button is also not working in the lightning component.Help me out. Thanx

<div class="container">                
    <form class="formbusiness">
        <h1>Account Information</h1>
        <div class="row">
            <h1 class="headingB">Business Account Info</h1>
            <div class="col-md-6">
                <ui:inputText aura:id="b_cname" class="form-control" value="{!v.newBAccount.Name}" placeholder="Company Name" required="true"/>
                <ui:inputNumber aura:id="b_bphone" class="form-control" value="{!v.newBAccount.Phone}" placeholder="Phone" required="true"/>
                <ui:inputEmail aura:id="b_bemail" class="form-control" value="{!v.newBAccount.Email__c}" placeholder="Email"/>
            </div>
            <div class="col-md-6">
                <ui:inputText aura:id="b_bstreet" class="form-control" value="{!v.newBAccount.BillingStreet}" placeholder="Billing Street"/>
                <ui:inputText aura:id="b_bcity" class="form-control" value="{!v.newBAccount.BillingCity}" placeholder="Billing City"/>
                <ui:inputText aura:id="b_state" class="form-control" value="{!v.newBAccount.BillingStateCode}" placeholder="State"/>
                <ui:inputText aura:id="b_country" class="form-control" value="{!v.newBAccount.BillingCountryCode}" placeholder="Country"/>
                <ui:inputNumber aura:id="b_zipcode" class="form-control" value="{!v.newBAccount.BillingPostalCode}" placeholder="Zip Code"/>
            </div>
        </div>
        <div class="row">
            <h1 class="headingB">Respective Contact</h1>
            <div class="col-md-6">
                <ui:inputText aura:id="b_rcfirstname" class="form-control" value="{!v.newBRCAccount.FirstName}" placeholder="First Name"/>
                <ui:inputText aura:id="b_rclastname" class="form-control" value="{!v.newBRCAccount.LastName}" placeholder="Last Name" required="true"/>
                <ui:inputNumber aura:id="b_rcmobile" class="form-control" value="{!v.newBRCAccount.MobilePhone}" placeholder="Mobile" required="ture"/>
            </div>
            <div class="col-md-6">
                <ui:inputEmail aura:id="b_rcemail" class="form-control" value="{!v.newBRCAccount.Email}" placeholder="Email"/>
                <ui:inputNumber aura:id="b_rcphone" class="form-control" value="{!v.newBRCAccount.Phone}" placeholder="Phone"/>                    
            </div>
        </div>
        <div class="buttonB">
            <ui:button label="Save" press="{!c.createBAccount}"/>
            <ui:button label="Cancel"/>
        </div>        
    </form>        
</div>

1 Answer 1

3

Can you provide some additional details about the controller(s), the JS code, etc.? How are you defining and loading the data, where are the picklists coming from, etc.? To construct a picklist in Winter '15 you will need to use a select and populate the option elements, then handle the change event to update the values. What is happening when you call the Action to create the record when the save button is pressed?

In the Spring '15 release you will find that the force:recordEdit and force:recordView components make this type of app much easier.

4
  • 2
    I'm not sure whether this is on the roadmap (I can create an idea if not), but it would be awesome if a developer in Lightning can do what's currently possible in Visualforce: Put <apex:inputField value="{!Lead.StateCode}"/> and <apex:inputField value="{!Lead.CountryCode}"/> on the same page, and have the picklists and their dependencies be automatically rendered.
    – Marty C.
    Commented Dec 19, 2014 at 6:52
  • @MartyC. can we use apex in the lightning ?? i have used it but nothing is happening .. i am trying to use a picklist in the lightning component instead of this -<ui:inputText aura:id="b_country" class="form-control" value="{!v.newBAccount.BillingCountryCode}" placeholder="Country"/> Commented Dec 19, 2014 at 12:35
  • 1
    Yes, you can use Apex with Lightning. Take a look at the gist mentioned in this question I posted a while back: salesforce.stackexchange.com/questions/55197/…
    – Marty C.
    Commented Dec 19, 2014 at 17:48
  • @MartyC. Thank you so much .. Really Worth for me.. Now understand the use of this . Commented Dec 22, 2014 at 7:02

You must log in to answer this question.

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