0

I'm trying to printing the selected value from dropdown list in lightning but when i select a value not responding

 my component :

   <lightning:select name="select" label="BookFair Accounts" required="true" messageWhenValueMissing="Did you forget to select a BookFair?" class="select-auto-width" aura:id="InputSelectDynamic" onchange="{!c.doGetAccounts}">
    <aura:iteration items="{!v.accounts}" var="acc" >
        <option value="{!acc.Name}">{!acc.Name}</option>
    </aura:iteration>
</lightning:select><br/>

component controller for getting drop down list:

doGetAccounts: function(component) {
var action = component.get('c.getAccounts');
var self = this;
action.setCallback(this, function(actionResult) {
 component.set('v.accounts', actionResult.getReturnValue());
});
$A.enqueueAction(action);

},

how can i get the selected value

2
  • can you please post the code for action "getAccountsOppsList". Commented Nov 22, 2017 at 3:55
  • @praveen thanks for giving the quick response .please find the my updated post
    – rAjA
    Commented Nov 22, 2017 at 4:07

1 Answer 1

1

You can access the value by the following code

component.find('InputSelectDynamic').get("v.value");

Hope this helps.

You must log in to answer this question.

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