Javascript form generator

Try jQuery dForm

Example:

var formdata = {
    "action" : "index.html",
    "method" : "get",
    "elements" :
    [
        {
            "type" : "p",
            "html" : "You must login"
        },
        {
            "name" : "username",
            "id" : "txt-username",
            "caption" : "Username",
            "type" : "text",
            "placeholder" : "E.g. [email protected]"
        },
        {
            "name" : "password",
            "caption" : "Password",
            "type" : "password"
        },
        {
            "type" : "submit",
            "value" : "Login"
        }
    ]
};

$("#myform").buildForm(formdata);

Builds:

enter image description here


Try one of the below mentioned plugins

http://code.google.com/p/jquery-form-builder-plugin/

http://www.botsko.net/blog/2009/04/07/jquery-form-builder-plugin/


If you're looking to generate dynamic forms using jQuery, then I'd recommend taking a look at Alpaca.

Alpaca is an open-source forms library (licensed under Apache 2). It generates forms based on JSON Schema using JavaScript and is pretty flexible so that you can register new control types, layouts, constraints and validation functions.

I think it would handle the scenario you described quite easily.

It has some nice template features (jQuery Templates), rendering engines for jQuery Mobile and a "connector" pattern so that you can read and persist form and layout definitions from a remote data source.

Note: I'm one of the developers at the company behind Alpaca. We open-sourced it because we thought it'd be great for the community. Alpaca is actively developed and we use it for our product (Cloud CMS). Others have used it for other CMS systems as well as projects backed by MongoDB and CouchDB, etc. Thus, it's had a lot of grind put into it.


inputEx seems ok

inputEx is an open-source javascript framework to build fields and forms for web applications using the YUI3 library.