Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript to generate/render dynamic HTML form from JSON or similar data?

I would like to offer viewers a contact form that is modified according to the user's input. An example of such a form is on the Ext JS site. I have not looked into the product, but I would like to know if there are any other programs/functions that generate such a form dynamically? I found only samples on adding other input elements to existing forms.

like image 222
none Avatar asked Jan 21 '23 11:01

none


2 Answers

Here are some other implementations:

  • http://neyeon.com/p/jquery.dform/ (depends on jQuery)
  • http://neyric.github.com/inputex/ (depends on YUI)
  • http://robla.net/jsonwidget/

I also plan to add this functionality to my own js-forms library, which would also handle validation.

like image 180
Jonny Buchanan Avatar answered Jan 30 '23 20:01

Jonny Buchanan


You can always create whatever DOM structure you like using JavaScript. Be it additional inputs or even additional FORM elements. It then depends of course what you use on the server side to process form data and how you do that.

Maybe I haven't understood the nature of your problem because you haven't explained yourself too good.

ExtJS is a JavaScript library that does everything on the client side. It also provides the ability to rapidly create user interface by providing Javascript configuration objects that will result in rich widget creation.

You can do lots with jQuery (and jQueryUI) as well, but it's up to you how to do it. ExtJS just has these very functionally rich and visually consistent set of client controls/widgets that you can use out of the box without much additional development (not to mention bug killing that comes along custom development).

For instance: When writing an Asp.net MVC application it's very easy to issue an Ajax call that would return HTML of so called partial view with complete HTML of your form that you can then easily display in a modal dialog for instance.

If you do need all that functionality to create a desktop-like application I suggest you do take a plunge into ExtJS because it is definitely a very good product. I've used it about 3 years ago (version 2) on some project and I was amazed by the work they've done with it. It's very feature rich product that makes it really easy to create desktop like web applications.

But if you're after a usual web site then a desktop-like experience is probably not what you should give to your visitors.

like image 23
Robert Koritnik Avatar answered Jan 30 '23 19:01

Robert Koritnik