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

How to duplicate a pageBlock or OutPutPanel in same page

Hi, I have a requirement for a visualforce page where, I need a number of identical forms to display depending on what # is entered into a text box.

Say for instance there is a form with the fields: Item_Name, Item_Description,Item_Number.

And then say the user wants to enter multiple items without switching to a new page everytime, so they go to a little inputText and enter "5", and click the button beside it.

Is there a way to display that initial form 5-times on the same page. 


Would I use Apex:repeat of some sort? If anyone could point me in the right direction I would very much appreciate it.






Arun MKArun MK



If you are going to display it in the same page, you can use the jQuery Clone function to duplicate the items.


In case, if you are going to display it in different pages, you can make use of apex:component.





Probably you can try to use <apex:component> functionality within the <apex:repeat> component, so that the same component will be displayed multiple times and the no.of component displayed depends on the # which is entered.