In the lightning documentation it states that I should be able to set a default value with the <option value="">
inside of a lightning:select
. When I attempt to do this, my option value gets overwritten with a value within the campaignOptions list. Why would I not be able to display this as the default value and require the user to update to a valid selection?
https://developer.salesforce.com/docs/component-library/bundle/lightning:select/documentation
<lightning:select aura:id="selectedCampaignId" name="selectedCampaignId" label="Select a Campaign:" required="true" value="{!v.selectedCampaignId}" onchange="{!c.isActive}" messageWhenValueMissing="Please select a Campaign">
<!-- why is this being overwritten? -->
<option value="">-- Please Select --</option>
<aura:iteration items="{!v.campaignOptions}" var="item">
<option text="{!item.Name}" value="{!item.Id}" selected="{item.selected}"/>
</aura:iteration>
</lightning:select>
value
on theselect
and theselected
on theoption
? – Drew Kennedy Aug 7 '19 at 16:47