Reputation: 157
OK, I have a customer name and address and simply want to display this in one computed field instead of separate lines in a table to save real estate. I've tried several iterations of @newline but to no avail. Can someone give me some guidance?
I would also like to NOT include Address2 if it's blank. I'm new to javascript. Thanks for your help.
var a = document1.getItemValueString("CompanyName");
var b = document1.getItemValueString("Address1");
var c = document1.getItemValueString("Address2");
var d = @Char(13);
a + @NewLine() + b + "<br>" + c;
Upvotes: 2
Views: 1259
Reputation: 1840
Mike,
I had to do nearly the same thing recently and used a Multiline Edit Box. Place your same code in data section of an <xp:inputTextArea>
(Multiline Edit Box in palette) and then make it read-only.
Upvotes: 4
Reputation: 30960
Set property escape="false"
in computed field and add <br />
whenever you want a newline.
You can set this property in properties tab selecting content type "HTML" too:
Your code would be
var a = document1.getItemValueString("CompanyName");
var b = document1.getItemValueString("Address1");
var c = document1.getItemValueString("Address2");
a + "<br />" + b + (c ? "<br />" + c : "");
Upvotes: 5