You need to sign in to do that
Don't have an account?
ArchieTechie6
Query and Split values by delimiter(semicolon) and display in <ul><li>
Hi All,
I am querying some data from custom object and this will be retrieved by semicolon seperated data.
Below is my code:
In my VF Page:
I want to display this in a bullet list using <li>
Thanks!
I am querying some data from custom object and this will be retrieved by semicolon seperated data.
Below is my code:
public class CustomController {
public string prodNames {get;set;}
public CustomController()
{
qryProd = [ Select id ,ProdNames from ProdObj];
}
if(qryProd<>null)
{
prodNames = qryProd[0].ProdNames;
}
}
}
public string prodNames {get;set;}
public CustomController()
{
qryProd = [ Select id ,ProdNames from ProdObj];
}
if(qryProd<>null)
{
prodNames = qryProd[0].ProdNames;
}
}
}
In my VF Page:
console.log('{!prodNames}') ---> This displays output as : Product1;Product2;Product45;Product49;
<apex:outputText style="font-weight:bold" value="All Product Names" /><br />
<ul>
<li><apex:outputText value="{!prodNames }"/></li>
</ul>
<apex:outputText style="font-weight:bold" value="All Product Names" /><br />
<ul>
<li><apex:outputText value="{!prodNames }"/></li>
</ul>
I want to display this in a bullet list using <li>
- Product1
- Product2
- Product45
- Product49
Thanks!
List<String> prodNames {get;set;}
prodNames = qryProd[0].ProdNames.split(',');
<ul>
<apex:repeat value="{!prodNames}" var="prodName" >
<li><apex:outputText value="{!prodName}"/></li>
</apex:repeat>
</ul>
Regards
All Answers
List<String> prodNames {get;set;}
prodNames = qryProd[0].ProdNames.split(',');
<ul>
<apex:repeat value="{!prodNames}" var="prodName" >
<li><apex:outputText value="{!prodName}"/></li>
</apex:repeat>
</ul>
Regards