Listing lookup values from multi-seletion looup field on display form

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
vegard.grutle
Posts: 59
Joined: Fri Mar 17, 2017

05 Jun 2018

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!

slashmaster
Posts: 29
Joined: Fri May 25, 2018

05 Jun 2018

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 :)

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

05 Jun 2018

Dear slashmaster,
It's a pretty neat piece of code! Thank you for answering - we love to see community interactions like this.
Cheers

slashmaster
Posts: 29
Joined: Fri May 25, 2018

06 Jun 2018

Hello Nikita,

thanks a lot. :) i'll try my best for "Knowledge Sharing" :)

greetz

User avatar
vegard.grutle
Posts: 59
Joined: Fri Mar 17, 2017

06 Jun 2018

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!

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

06 Jun 2018

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.
Cheers

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests