You need to sign in to do that
Don't have an account?
lightning component superbadge javascript controller issue
I'm on the second challenge of the Lightning Components Superbadge. I've created my BoatSearchForm.cmp, and the BoatSearchFormController.js. I need to pull the value from the pulldown selector. I have an onChange event that calls the handleChange handler, but then it fails when I try to call event.getParam("value"). It says event.getParam function doesn't exist!
Here's the code:
cmp excerpt:
Any idea why it's not taking the event.getParam()?
Here's the code:
cmp excerpt:
<select class="slds-select" id="selectType" onchange="{!c.handleChange}" > <option value="">All Types</option> <aura:iteration items="{!v.BoatTypes}" var="boatType"> <option value="{!boatType.Id}">{!boatType.Name}</option> </aura:iteration> </select>And the handler from my js controller:
handleChange : function(component, event){ var selectedValue = event.getParam("value"); console.log(selectedValue); },I know that handler doesn't actually set anything... I'm still just trying to access the value that is selected in the pulldown of the cmp. Once I get that, I can assign it with a component.set() line.
Any idea why it's not taking the event.getParam()?
sorry for late response,
you should use lightning:select or ui:inputselect control and use your handleChange code like below
handleChange : function(component, event){
var selectedValue = component.find("selectType").get("v.value");
console.log(selectedValue );
},