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

Repeating a component in visualforce page

Hi All,


I have a page (MyTestPage) containing my custom component (MyComponent). What I want to do is repeat this component on this page. Something like below.


<apex:page controller="MyPageController">
<apex: repeat ....>
 <c: MyComponent/>

 Is there any way to repeat a custom component using repeat? I have seen the documentation and so far I could not find any examples where a custom component was repeated on a page using repeat.


I am new to Salesforce so my idea might be wrong. In any case please let me know.


Thanks for the help.



Prafull G.Prafull G.
You can do it. You are on the right path.

Did you get any error while doing so?

I want to pass three different custom objects to that component and make a for loop to perform operations on that custom object. 


Consider this as an example:


I have 3 custom objects: object1_c, object2_c, object3_c


<apex:repeat  .... give the 3 custom objects to be used in the form (how to do this?)>
<apex: form>
// in this form I deal with the received custom object


I already have a controller where I am using one of the custom object (hardcoded its API name) in the form. I want to perform a loop where I can receive the custom object and give it to the form in the controller to do the work.