You need to sign in to do that
Don't have an account?
MRITYUNJAY PATEL 3
How to get the Account Name in Controller.js
Hello there,
Please solve my problem, first time i am trying to ask question .
this is my component code:
<select aura:id="AccList" class="slds-select" >
<option>All</option>
<aura:iteration items="{!v.Accounts}" var="category" indexVar="index" >
<option>{!category.Name}</option>
</aura:iteration>
</select>
Controller.js
var selectedValue= component.find("AccList").get("v.Value");
alert("selectedValue:"+selectedValue);
Advance Thanks
Please solve my problem, first time i am trying to ask question .
this is my component code:
<select aura:id="AccList" class="slds-select" >
<option>All</option>
<aura:iteration items="{!v.Accounts}" var="category" indexVar="index" >
<option>{!category.Name}</option>
</aura:iteration>
</select>
Controller.js
var selectedValue= component.find("AccList").get("v.Value");
alert("selectedValue:"+selectedValue);
Advance Thanks
Hi,
Please find the solution.
You are not able to get the values in selectedValue variable because js is case sensitive
wrong: var selectedValue= component.find("AccList").get("v.Value");
correct: var selectedValue= component.find("AccList").get("v.value");
you can try other way also
component:
controller:
Please let me know it is working or not?
Please mark it as the Best Answer so that other people would take reference from it.
Thank You
All Answers
Try modifying your code in following manner:
And in the JS file you can access it in following way:
Refer to similar example here on below thread for more clarity:
https://salesforce.stackexchange.com/questions/106015/lightning-how-do-i-get-the-selected-value-from-a-select-dropdown-list-send-i
Hope above information helps. Please mark as Best Answer so that it can help others in future.
Thanks.
Hi,
Please find the solution.
You are not able to get the values in selectedValue variable because js is case sensitive
wrong: var selectedValue= component.find("AccList").get("v.Value");
correct: var selectedValue= component.find("AccList").get("v.value");
you can try other way also
component:
controller:
Please let me know it is working or not?
Please mark it as the Best Answer so that other people would take reference from it.
Thank You
Please use below code:-
controller.js:-
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh