0

I am getting address info from a external system in below format:

"street1":"",
"street2":"",
"street3":"",
"city":"",
"state":"",
"country":""

which i am storing in a map attribute like below:

<aura:attribute name="address" type="map" default="{street1:"",street2:"",street3:"",city:"",state:"",country:""}" />

and i am setting the value like below:

<lightning:inputAddress
            addressLabel="Address"
            streetLabel="Street"
            cityLabel="City"
            countryLabel="Country"
            provinceLabel="Province"
            postalCodeLabel="PostalCode"
            street="{! v.address.street1 +'\n'+v.address.street2+'\n'+v.address.street3}"
            city="San Francisco"
            country="US"
            province="CA"
            postalCode="94105"
        />

now, i am able to see the value in multiple lines but when i am trying to update the value, i am not getting the updated values.

Is there a different/easy way to show multiple street lines using inputAddress component other than this format?

UPDATE

Added solution that i used as answer.

8
  • Can you edit your question to clarify a bit? You are saying you are getting to see the values in multiple lines, but later you want to show it in multiple lines. Seems you already have what you want?
    – Jayant Das
    Commented May 16, 2019 at 19:43
  • @JayantDas Just updated. I was not getting the updated values.
    – SunnyG
    Commented May 16, 2019 at 19:47
  • So is your question around not being able to get updated values or not being able to show in multiple lines? If its around update, how are you updating the values?
    – Jayant Das
    Commented May 16, 2019 at 19:47
  • @JayantDas i wanted to ask if there's any other way to implement this rather than how i am doing it now. when i update the street value and go to next screen which is a summary section i am not seeing updated value but just the value i got from external system.
    – SunnyG
    Commented May 16, 2019 at 19:55
  • This is based on the assumption that you are fetching the value on your summary screen most likely using the attribute v.address. If yes, then you will need to ensure that whenever you are navigating from one screen to other, the attribute v.address is updated with the contents that you have entered in the previous screen. For anything else, you will need to provide more code here for anyone to be able to help.
    – Jayant Das
    Commented May 16, 2019 at 19:57

1 Answer 1

0

I replaced street1, street2, street3 from Map with street

<aura:attribute name="address" type="map" default="{street:"",city:"",state:"",country:""}" />

and passing the concatenated value (street = street1+'\n'+street2+'\n'+street3) in the controller after getting those from the external system.

You must log in to answer this question.

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