I have a field which displays values in visualforce Page as follows "a;b;c;d" i want the values to displayed as comma separated values as "a,b,c"

I using a repeat tag inside which i have field {!a.test}

I do have pagination and its displaying in the initial page as "a,b,c" and when i clicking on next it is displaying nothing i am using the below javascript.

var tList="{!a.test}";
tList = tList.substring(0, tList.length - 1);
var tSplit=tList.split(';');
var TypeDis='';
for(var x=0;x<tSplit.length;x++){
TypeDis+=tSplit[x]+', ';
TypeDis = TypeDis.substring(0, TypeDis.length - 2);

You need to use a function SUBSTITUTE:

<apex:outputText value="{!SUBSTITUTE(a.test ,';',',')}" />

This function substitutes new text for old text in a text string. See the docs here.

| improve this answer | |

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.