← Back to Upcase

OO design of a form builder


(David Pedersen) #1

I have to build a form builder for work. A form builder is a tool like Wufoo where you can build forms without writing code.

I’m having trouble coming up with a good OO design. The form builder should have a rather ajaxy interface, the forms should of course be persisted in a relational database, and should allow the user to build both simple and complex forms.

Right now I have come up with the following designs:

  • Do as little backend stuff as possible. Manipulate and build the forms client side and then just save the raw html in the database as text. This puts as much form building logic into the front end and makes persistence very simple.

  • Use the composite pattern to represent the form in the backend and have a way of converting those objects to HTML. The client side would then communicate with the server over ajax whenever the user wants to manipulate it somehow. This puts most of the form building logic into the backend, makes persistence more tricky, and would require a lot of ajax calls.

Any input?


(Matthew Sumner) #2

As always there is a railscast on the topic. However, it is also very simple to use a service like wufoo and have it integrate into your own application.


(Derek Prior) #3

I’d check this out to see if it makes sense for you. Building something like wufoo - unless the product exists to be a competitor to wufoo - is going to be a big undertaking. I’d check to see if integrating with wufoo or survey monkey makes sense.