Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

When selecting multiple values, the data is separated with semicolons. When many values are selected it starts looking cluttered.

Is there any way to have each value on a new line?

For example, instead of:

Image1;Image2;Image3

I would like:

Image1
Image2
Image3

I'm using a lookup column inside a picture library. When looking at it within SPD it renders as a webpartpages:ListFormWebPart.

Is there any way of accomplishing this with Javascript?

share|improve this question

3 Answers 3

I had a similar item come across my dest a few days ago. Using javascript and jquery. The code replaces the html coding of a semicolon with a html line break. It then copies the code and replaces the orginal code with it.

$(document).ready(function(){
  $(".ms-vb:contains(';')").each(function(){
    var htmlstr = $(this).html();
    var htmlmod = htmlstr.replace(/; <A/g,"</br><A");
    $(this).html(htmlmod);
  });
});
share|improve this answer
    
Thanks so much, this code really helped. One remark: I did have to lower the capitalization of the A tags: var htmlmod = htmlstr.replace(/; <a/gi,"</br><a"); –  Ferdy Oct 7 '13 at 10:29

I think Spservice and multiple choice filed values will help you to work around this problem.

share|improve this answer

You might be able to use an article by Dessie Lunsford to create a calculated column to search and replace the semi colon with a space. This one might be helpful too.

share|improve this answer
1  
I appreciate your help, but I don't think a calculated column will help me in this instance. The calculated column will not let me select the lookup column I need to alter. The lookup column is a semicolon separated list of multiple images that belong to another picture library. I was able to use javascript to replace the semicolon with a line break, but it breaks the links of the images. Anyone have any ideas? –  user2302 Feb 2 '11 at 13:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.