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
vishesh91vishesh91 

link as a label to select option

hi I have selectCheckBoxes tag in my vf page,which gets its select options from a method.I want to have label appearing next to each checkbox as a link.How to achieve this,Please help.

Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below code snippet as reference:

------------- Vf page----------------

 

<apex:page controller="sampleCon" >
<apex:form >
<apex:selectCheckboxes id="step1Options" >
<apex:selectOption itemValue="AA1" itemEscaped="false" itemLabel="{!test1}" rendered="{!IF(country=='First',true,false)}" />
<apex:selectOption itemValue="AA2" itemEscaped="false" itemLabel="{!test2}" rendered="{!IF(country=='First',true,false)}" />
<apex:selectOption itemValue="AA3" itemEscaped="false" itemLabel="{!test3}" rendered="{!IF(country=='First',true,false)}" />
<apex:selectOption itemValue="BB1" itemEscaped="false" itemLabel="{!test4}" rendered="{!IF(country=='Last',true,false)}" />
<apex:selectOption itemValue="BB2" itemEscaped="false" itemLabel="{!test5}" rendered="{!IF(country=='Last',true,false)}"/>
<apex:selectOption itemValue="BB3" itemEscaped="false" itemLabel="{!test6}" rendered="{!IF(country=='Last',true,false)}" />
</apex:selectCheckboxes>

</apex:form>
</apex:page>
--------- Apex class -----------------
public class sampleCon
{
public string test1{get;set;}
public string test2{get;set;}
public string test4{get;set;}
public string test3{get;set;}
public string test5{get;set;}
public string test6{get;set;}
String country = 'First';
public boolean chk{get;set;}
public sampleCon()
{
chk=true;
test1='<a href="#">test11</a>';
test2='<a href="#">test12</a>';
test3='<a href="#">test13</a>';
test4='<a href="#">test14</a>';
test5='<a href="#">test15</a>';
test6='<a href="#">test16</a>';
}




public String getCountry() {
return country;
}
}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

vishesh91vishesh91

but how to use <apex:repeat> inside <apex:selectCheckBoxes> . I dont know the no of selectOptions beforehand,they come from a controller.I want to do something like this..

<apex:selectCheckboxes value="{!leadsToConvert}" layout="pageDirection">

       <apex:repeat value="{!Leads}" var="lead">

                <apex:selectOption itemvalue="{!lead}" itemlabel="{!'<a href="#">'+lead+'</a>'}"/>

       </apex:repeat>

</apex:selectCheckboxes>

 

......where getLeads() method in controller returns a string array.