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.

On Thu, May 27, 2010 at 8:04 AM, Ravi D. [email protected] wrote:

I need to add textbox dynamically when I click “Add” button.

How can I achive this functionality?

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:


Hassan S. ------------------------ [email protected]
twitter: @hassan

On 27 May 2010 16:35, Hassan S. [email protected]
wrote:

On Thu, May 27, 2010 at 8:04 AM, Ravi D. [email protected] wrote:

I need to add textbox dynamically when I click “Add” button.

How can I achive this functionality?

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

On Thu, May 27, 2010 at 9:09 AM, Colin L. [email protected]
wrote:

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

Or AJAX could be used.

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


Hassan S. ------------------------ [email protected]
twitter: @hassan

On 27 May 2010 17:20, Hassan S. [email protected]
wrote:

On Thu, May 27, 2010 at 9:09 AM, Colin L. [email protected] wrote:

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

Or AJAX could be used.

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

On Thu, May 27, 2010 at 9:35 AM, Colin L. [email protected]
wrote:

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.

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


Hassan S. ------------------------ [email protected]
twitter: @hassan

that might help

chewmanfoo wrote:

#75 Complex Forms Part 3 - RailsCasts

that might help

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

Thanks all for replying.