+ Start a Discussion
SalesforceLearnerNewbieSalesforceLearnerNewbie 

how to print the repeater ID in vf page?

How can I print the repeat ID of an apex:repeat?

example my loop is  ["I have " ,"something", "todo"]

I wish to print each repeat ID of this list. 
Raj VakatiRaj Vakati
Refer to this code
 
public class repeatCon {

    public String[] getStrings() {
        return new String[]{'I have','something','todo'};
    }

}

Page
 
<apex:page controller="repeatCon" id="thePage">

    <apex:repeat value="{!strings}" var="string" id="theRepeat">

        <apex:outputText value="{!string}" id="theValue"/><br/>

    </apex:repeat>

</apex:page>

 
SalesforceLearnerNewbieSalesforceLearnerNewbie

Hi,

 

Thank you for your reply but may I know where did you define the "strings" within the apex:repeat value? And also, why you use "theValue" I dont get where you define all these parameters. Could you give us more better explanations, please? 

SalesforceLearnerNewbieSalesforceLearnerNewbie
And also, this is not printing the ID of the element within the LIST but the element itself. Its not working. 
 
Raj VakatiRaj Vakati
id values is just reference and no need to use the id .. the below code will work 
 
<apex:page controller="repeatCon" id="thePage">

    <apex:repeat value="{!strings}" var="string" id="theRepeat">

        <apex:outputText value="{!string}" /><br/>

    </apex:repeat>

</apex:page>