add textbox dymamically

Hii

I need to add textbox dynamically when I click "Add" button.

On clicking on button the textboxes are to be displayed one below the
other.

I enter different text in different textboxes, when clicked submit
button all the content in all the textboxes should be saved.

How can I achive this functionality?

Please help. Thank you.

A client-side action like this is done with JavaScript.

A JS library like Prototype or jQuery can be helpful, but you still have
to write the code :slight_smile:

Or AJAX could be used.

Colin

Which is still JavaScript, but with a pointless (in this case) round-trip
to the server :slight_smile:

It is probably correct that the round trip to the server is pointless,
but not necessarily, we do not know enough about the requirement.
Maybe the text boxes to be added depend on data the user has entered
and in data in the database in some way that would make AJAX more
appropriate.

Colin

Of course that's possible, but if so certainly not apparent in the OP's
description of the task.

http://railscasts.com/episodes/75-complex-forms-part-3

that might help

chewmanfoo wrote:

http://railscasts.com/episodes/75-complex-forms-part-3

that might help

Thanks chewmanfoo, this is what the functionality Im looking for.

Thanks all for replying.