Page 1 of 1
Listing lookup values from multi-seletion looup field on display form
Posted: 05 Jun 2018
by vegard.grutle
A SharePoint list has a multi-selection lookup field.
When 2 or more values are selected for an item,it is displayed(in the view)as:
Value1,Value2,Value3,Value4,Value5,Value6
Is there a way that I can display this field as shown below?
Value1,
Value2,
Value3,
Value4,
Value5,
Value6
Thanks!
Re: Listing lookup values from multi-seletion looup field on display form
Posted: 05 Jun 2018
by slashmaster
Hi vegard.grutle,
i am doing it like this:
Code: Select all
//.. HTML auslesen
var vDummy = fd.field("Risiko").control()._el().html();
//.. Semikolon mit Zeilenumbruch im gesamten (/g) String ersetzen
vDummy = vDummy.replace(/; /g, "<br>");
//Wert zurückschreiben
fd.field("Risiko").control()._el().html(vDummy);
Greetz
Re: Listing lookup values from multi-seletion looup field on display form
Posted: 05 Jun 2018
by Nikita Kurguzov
Dear slashmaster,
It's a pretty neat piece of code! Thank you for answering - we love to see community interactions like this.
Re: Listing lookup values from multi-seletion looup field on display form
Posted: 06 Jun 2018
by slashmaster
Hello Nikita,
thanks a lot.
i'll try my best for "Knowledge Sharing"
greetz
Re: Listing lookup values from multi-seletion looup field on display form
Posted: 06 Jun 2018
by vegard.grutle
Thanks, slashmaster
Im not too much into coding. Could you please let me know what "vDummy" represent. I would think that "Risiko" is the name of the field.
Thanks!
Re: Listing lookup values from multi-seletion looup field on display form
Posted: 06 Jun 2018
by Nikita Kurguzov
Dear Vegard,
This is just a variable to temporarily store the HTML from the field and format it into a column, which then replaces the default HTML of the field. You can change the name of the variable, just make sure it's the same everywhere, and use the correct internal name for the field.