You need to sign in to do that
Don't have an account?
bretondev
onChange event on lightning:select throws error message
I have a picklist with an onchange event bound to it.
When I select a value in the picklist, I get the following error message :
This page has an error. You might just need to refresh it. Error in $A.getCallback() [b.run is not a function] Failing descriptor: {lightning:select}
Component :
When I select a value in the picklist, I get the following error message :
This page has an error. You might just need to refresh it. Error in $A.getCallback() [b.run is not a function] Failing descriptor: {lightning:select}
Component :
<aura:component> <aura:attribute name="colors" type="String[]"/> <aura:attribute name="selectedColor1" type="String"/> <aura:handler name="init" value="{!this}" action="{!c.loadOptions}" /> <lightning:select aura:id="select1-id" value="{v.selectedColor1}" onchange="{c.onChangeColor}" name="picklist1" label="Select a Color" > <option value="">-- None --</option> <aura:iteration items="{!v.colors}" var="color"> <option value="{!color.value}" text="{!color.label}"></option> </aura:iteration> </lightning:select> </aura:component>Controller :
({ loadOptions: function (component, event, helper) { var opts = [ { value: "R", label: "Red" }, { value: "G", label: "Green" }, { value: "B", label: "Blue" } ]; component.set("v.colors", opts); }, onChangeColor: function (component, event, helper) { //var myColor = event.getSource().get("v.value"); //var test; } })
There is small syntext error issue -- {!v.selectedColor1} & {!c.onChangeColor} here ' ! ' is missing
Regards
Ashif
All Answers
There is small syntext error issue -- {!v.selectedColor1} & {!c.onChangeColor} here ' ! ' is missing
Regards
Ashif