+ Start a Discussion

How to render a field multiple times on Visualforce page?


I ahve a requirement where I need to give the user an ability to enter a free text multiple times. FOr eg; I have a field named PIN. I will create a button named 'add additional PINs'. On click of the button the field should be rendered multiple times on the page. User will enter the value and the values entered in each field  must be stored in a Long text area field seperated by commas. 

Can I achieve this in VF page? Any suggestions on the code please!!

Thank you in advance for the help!!
You can create list of innerClass and try that
Create a new VF Page with a controller or extensions , Declare a wrapper class like 

public class addpin
public string inputpin{get;set;}

whenever user clicks on add new pin button, create a dummy entry and reload the datatable or pageblocktable. while saving iterate through the wrapper class and (read) all the values from the wrapper class  "inputpin" and finally save to the rich text field separated by comma.

Hope this helps :)
Hi suresh and Peace maker,

Thank you so much for the prompt response. 

I am am a newbie to the programming world. I really tried hard to understand the wrapper class but I could not figure out the logic. I know it's more to ask, but Could you please help
me with the code for my requirement and I will be able to understand it better. 

Thank you !!!
Have  a look at this URL, you will get an idea of using Wrapper class.

Wrapper class are nothing but a placeholder for records/data. where you can declare , store and use for later DML operations.