function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rick SF AdminRick SF Admin 

How to display selected multi-picklist values as a vertical list on a visualforce page

I've created a VF page and I'm trying to get the selected multi-picklist values to display as a vertical list opposed to a single string. 
Selected values are displaying as "Value1; Value2; Value3". I would like the values in a list with bullets.
  •  Value1
  •  Value2
  •  Value3

I found a a forum with this same issue but its not working for me. - https://developer.salesforce.com/forums/?id=906F0000000BGyzIAG

Here is the code that I am using. 
<td>
      <apex:outputField value="{!Employee_Profile__c.Professional_Certifications__c}"> <p id="demo"></p>
      </apex:outputField>
</td>    

 <script>
        var myString = '{!Employee_Profile__c.Professional_Certifications__c}';
        var res = myString.replace(new RegExp(';', 'g'), '<br/>');
        document.getElementById("demo").innerHTML =res;        
</script>  
 
    </table>      

</apex:page>
Suraj TripathiSuraj Tripathi
Hi  RickRH,

Below is the piece of code. Please try this, it is working fine my Org.
<apex:page standardController="Account">
    <p id="demo">
        <apex:outputField value="{!Account.Products__c}"></apex:outputField>
    </p>
        
<script>
        var myString = '{!Account.Products__c}';
    	var res = myString.replace(new RegExp(';', 'g'), '<br/>');
		document.getElementById("demo").innerHTML =res;        
</script> 
</apex:page>

Screenshot :
User-added image

Hope it Helps you. Please mark this as solved so that it gets removed from the unanswered queue which results in helping others who are encountering a similar issue.

Regards ,
Suraj
Rick SF AdminRick SF Admin
Am I missing something? I used the code and I'm still getting the same results. 
<tr>
    <td style="color:#154F82; font-size: large; font-weight: bold">
         <u>Certifications</u>
    </td> 
</tr>
 
      <p id="demo">
        <apex:outputField value="{!Employee_Profile__c.Professional_Certifications__c}"> </apex:outputField>
       </p>
 
</table>           

<script>
        var myString = '{!Employee_Profile__c.Professional_Certifications__c}';
    	var res = myString.replace(new RegExp(';', 'g'), '<br/>');
		document.getElementById("demo").innerHTML =res;        
</script> 
    
</apex:page>
Results:

User-added image
 
Rick SF AdminRick SF Admin
Also the page is a PDF. Could that be the issue?

<apex:page standardController="Employee_Profile__c" renderAs="pdf">