function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Patrick McClellanPatrick McClellan 

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:
<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()?

 
Patrick McClellanPatrick McClellan
BTW, the exact error message is this:
User-added image
dandamudidandamudi
@Patrick
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 );
    },