Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript form generator

Does anybody know of a javascript library for auto generating a form based upon a model?

ie, given a model something like:

{
    name: "someone",
    email: "[email protected]",

}

you'd get a form like:

Name: ___________
Email: __________

Matt

like image 627
Matt Brailsford Avatar asked Jan 19 '12 09:01

Matt Brailsford


1 Answers

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.

like image 110
Michael Uzquiano Avatar answered Sep 19 '22 19:09

Michael Uzquiano