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.

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 '19 at 0:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.