views:

1087

answers:

2

I was wondering if there is a JavaScript based HTML Form builder, similar to what you can do with Zend_Form_Html or with the ExtJS Forms but based on JQuery? There are several form related plugins but you still have to code every form manually. The idea is, that I usually only want to edit/add single entities from my Domain Model (e.g. in Doctrine with PHP), lets say a new user. I have the user as a JSON Object

{
    'username': 'John',
    'email': '[email protected]',
    'name': 'John Doe'
    'age': '33'
}

And I could also make some meta information available (e.g. the Database knows already that age must be an Integer so I already can attach that client side validator or display a nice number spinner).

{
    'entity': 'User',
    'email': 
     {
      'type': 'text',
      'validate': 'e-mail',
      'max_lengh': 255
     },
    'name': 
     {
      'type': 'text',
      'validate': 'string',
      'max_lengh': 255
     },
    'age': 
     {
      'type': 'spinner',
      'validate': 'integer',
      'range': [0, 120]
     }
}

With this information you could already build a scaffold form so that you only have to add/edit the additional information needed. On my quick search I unfortunately didn't find anything like that.

A: 

I don't think there is one for jQuery that supports JSON input, but take a look at:

http://javascript.neyric.com/inputex/ for YUI

Sidmitra
Thanks a lot. That doesn't look too bad. I already started my own plugin to programatically create forms trying to support several other plugins like validation and form for jQuery but maybe the one for YUI gives some additional inspiration. I'll try to post my result here soon...
Daff
A: 

Since nothing like this popped up yet, I started my own project on github (moved from Google code) called jquery.dform. It is a jQuery plugin for creating html forms via JSON.

It is still in its early development stages but it is starting to get things done.

Daff