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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With