2

A SharePoint list has a multi-select choice 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

  • Are you 2013? Then look into CSR - ClientSideRendering – Danny '365CSI' Engelman Aug 7 '15 at 13:00
  • @DannyEngelman No,I'm in 2010 – George Aug 7 '15 at 13:01
3

This should do it:

  1. Download jQuery and save it to /SiteAssets/
  2. Create a JavaScript file named comma-break.js and save it in /SiteAssets/ with the contents of:

$(document).ready(function () { var str = $('.ms-listviewtable').html(); //; $('.ms-listviewtable').html(str.replace(new RegExp(", ", "g"), ",</br>")); });

  1. Add a Content Editor Web Part to your list and link to the jquery.min.js file.
  2. Add a Content Editor Web Part to your list and link to the comma-break.js file.
  • also I assumed in that code, that you meant semi-colon instead of colon. If you in fact meant colon than just replace the two semi-colons in the code with colons. – James Flattery Aug 7 '15 at 12:06
  • when i tried your script,the field value became invisible. – George Aug 7 '15 at 12:29
  • Sorry about that! I should have verified the code before submitting. I updated the code and it appears to work for me. Please let me know if you have any problems. – James Flattery Aug 7 '15 at 13:34
  • You may want to change </a>; to , and </a>;</br> to ,</br> The list I was originally playing with was a multi-lookup select instead of just a multi-select. – James Flattery Aug 7 '15 at 13:50
  • I have the below script now and its not working. $(document).ready(function(){ var str=$('.ms-listviewtable').html(); //; $('.ms-listviewtable').html(str.replace( new RegExp(",","g"),",</br>")); }); – George Aug 7 '15 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.