Developer forum

Forum » Dynamicweb 10 » Frontend address format

Frontend address format

Cátia Torego
Reply

Hi,

When using the custom option of the Address edit format it respects the fields in the input but it doesn't respect the lines. In the template we get a list with only one element with all the fields, instead of one for each line.

DW version 10.14.2

 

FrontendAddressFormat.png

Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

I think it is a CSS issue. The actual wrapper around the address format lines happens in this template in Swift 1:

https://github.com/dynamicweb/Swift/blob/v1.26.8/Swift/Files/Templates/Designs/Swift/UserManagement/Helpers/UserProfileEditFormatted.cshtml

Try to inspect the markup and see if you can find the CSS issue.

Or provide a link here for me to take a look.

 
Cátia Torego
Reply

Hi Nicolai,
I don't think I explained this in the best way. 

If we have something like this:

{name}{company}
{address1}

I was expecting, when we loop through addressFormat the first time, the addressLine to be a list of strings whith
{name},{company}
And when we get the columnSize, from GetBootstrapColumnSizeForUserProfileAddress, I was expecting g-col-12 g-col-lg-6
And then we would go to the second line
{address1}
and get g-col-12 g-col-lg-12

Instead, when we loop through addressFormat the first time, the addressLine is a list with everithing 
{name},{company},{address1}
And when we get the columnSize, from GetBootstrapColumnSizeForUserProfileAddress, it returns g-col-12 g-col-lg-4

It looks like the issue comes from GetEditAddress that is not respecting the diferent lines

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

bump

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Nuno

Make a pull request so it works like you want it.

BR Nicolai

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply

Hi Nicolai,

I looked at this issue but I am not sure where the root cause is. I can see only \n being sent in country save model request but looks like code GetAddressFormat method is expecting System.Environment.NewLine (\r\n) for the replace. 

A screenshot of a computerAI-generated content may be incorrect.

 

A computer screen shot of a computer codeAI-generated content may be incorrect.

A screenshot of a computerAI-generated content may be incorrect.

 

BR Mario

 

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Of course - anoying issue!

Change the splitter to do it like this:

string[] lines = addressFormat.Split(
    new string[] { "\r\n", "\r", "\n" },
    StringSplitOptions.None
);

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply

Hi Nicolai,

Just to be on the same page, is this something DW core team will handle? We can patch it for now in templates.
Happy to submit a PR to DW with the change.

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Please make a pull - we will merge it in and test.

 
Mario Santos Dynamicweb Employee
Mario Santos
Reply

https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_git/Dynamicweb10/pullrequest/17674 

 

You must be logged in to post in the forum