I showed before how to use the dynamic tag library to create dynamic forms/tables that can show an unknown number of fields. While using those tags is very easy, they are meant for read-only data view. What if you actually want to create a page with input fields, but you don't know ahead of time how many fields will be needed?
Well here is a little solution.
It uses an array that lists the fields you'll want to show, and then an iterator in the page to run over this array and display the fields.
Application zip file is here.
And here is a short demo showing the form in action and explaining what is happening behind the scenes.
By the way, in the zipped version I added another button to the page that when pressed adds one more field to the form.