Dynamic Forms Revisited

dynamic forms

Why I called this a revisited issue is because I’ve asked this before in the stackoverflow community. Check this link: http://stackoverflow.com/questions/2293512/web-ui-dynamic-web-forms.

The problem lies in the dynamic generation of components from within a form, for instance, your data-structure follows the one-has-many setup. Take for example a person who has one or more cars, then we would like to have multiple cars to add or to remove from the form.

Lately, a similar project reached my desk and I am faced with a very similar issue. Before, I’d just rewrite the code I wrote as a patch-up to what I did years ago using duplicate javascript code with the help of jquery and json. But alas, I’d want a plugin to do the work for me, well, extjs, a product of sencha is for-sale and its good but I’d like a small fix that would simply solve my problem, at least.

Again, I tried searching the web for alternatives on what to use re: dynamic forms and the keyword ‘lambda’ appears. A solution has been rediscovered after all this time http://code.google.com/p/jquery-dynamic-form. This solution is the perfect candidate to solve my dynamic forms problem, the code is as simple as this:

dynamic form

I intend to make a simpler example of the code so that it’d be easier to read.

Javascript: [cc lang=”php” tab_size=”2″ lines=”-1″]


HTML:[cc lang=”php” tab_size=”2″ lines=”-1″]


[-] [+]


Just in case the later versions of jquery.dynamic do not work for you, I have included the jquery plugin I used and tested.

I’ve used jquery version 1.4.2.

download source: jquery.lambda