+ Start a Discussion
Ryan GreeneRyan Greene 

Update attribute value

Hello,
I have a compnent with address fields for Mailing and Shipping. I have created a button to copy the mailing address info to the shipping fields. The mailing address gets prepopulated but may need to change if there is no Unit# Apt# ect. Also, for the street address field I need to concatenate the street number, a space, and the street name, I cannot get around this since it is how the address is pulled from the external database. My problem is the street address will not update properly on keyup. It works perfectly for the City, State or Zip, but when extra charachters are typed into the address field it deletes the info on keyup, I think it is reverting to the'default'. Component:
<aura:attribute name="Street" type="String" />
<aura:attribute name="StreetNum" type="String" />
<aura:attribute name="Space" type="String" />
<aura:attribute name="City" type="String" />
<aura:attribute name="Zip" type="String" />
<aura:attribute name="add1" type="String" default="{!v.StreetNum + v.Space + v.Street}"/>

<ui:inputText aura:id="streetadd" class="slds-input" value="{!v.add1}"
                              placeholder="Street" disabled="false" updateOn="keyup"/>
<ui:inputText aura:id="city" class="slds-input" value="{!v.City}" 
                              placeholder="City" disabled="false" updateOn="keyup"/>
<ui:inputText aura:id="zip" class="slds-input" value="{!v.Zip}" 
                              placeholder="Postal Code" disabled="false" updateOn="keyup"/>
Any ideas?
Thanks!
Ryan