1

I have selectbox in my Lightning component. It displays data from "leadFieldOptions" and set default value from "selectedValue".

<ui:inputSelect multiple="false" value="{! selectedValue }">
    <aura:iteration items="{! leadFieldOptions }" var="option">
        <ui:inputSelectOption text="{! option.value }" label="{! option.label }"/>
    </aura:iteration>
</ui:inputSelect>

After I change value in selectbox "selectedValue" still has previous value.

1 Answer 1

4

You are missing Value Provider.

i.e) Value providers used to access data and encapsulate related values together, similar to how an object encapsulates properties and methods.

The value providers for a component are v (view) and c (controller). Learn Usage of Value Provider

<ui:inputSelect multiple="false" value="{!v.selectedValue }">
    <aura:iteration items="{!v.leadFieldOptions }" var="option">
        <ui:inputSelectOption text="{! option.value }" label="{! option.label }"/>
    </aura:iteration>
</ui:inputSelect>
1
  • How would you get the value if the inpoutselected was generated inside a loop? so you cant assign value?
    – manza
    Mar 10, 2019 at 0:09

You must log in to answer this question.

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