View Full Version : Dynamically adding html/form to page

07-14-2005, 06:16 AM
I have a html form which consists of various resume details.

Part of this form is a 'employment history' sub-form (start date, end date, position etc) (1 per job)

The problem is that the user may need to enter 1-5 employment history records but I want to display only 1 form by default and let them add more if they want.

.. so I need a button which users can click, when they click this a piece of html code (employment history form) is added/displayed under the last.

is this possible? or do th forms already need to exsist in the html?

07-14-2005, 09:00 AM
this may assist


07-14-2005, 12:35 PM
You may do that in 2 different ways.

1. If you need to create/change dynamic some elements, you may use DOM methods (like in vwphillips example)

2. If you need only to restrain the length of the page (in order to let the user fill the form step by step) you may simply use the display attribute (none/block) to hide/reveal the already built in elements. The second methods has the advantage that the formular can be use as well by the users who might have their javascript disabled.