I always hesitate which method is easier, faster and more efficient (in terms of development time and costs): to create web forms manually (e.g. copy/paste crappy html code in the form templates) or to use some form generator engine. I know this sounds funny because I'm one of the developers of
such a package. Why hesitating then? Because there's no one best solution that fits everything. I
had the same problem with template engines in the last month. The conclusion was to use an engine that gives the greatest flexibility and has no limitations.
When I work without the designer friends of mine (respect,
1,
2, in no particular order) I have to write html forms on my own. It's very frustrating to see yourself typing the same code every week over and over again when you know you have more important tasks to do. Additionally, if you care about usability, you have to flood your form templates with so much crappy code to display error messages belonging to specific fields. Sometimes it comes handy to pass back a form freezed to the user for confirmation. If you create your templates manually, it takes many time to achieve this.
I'm looking for a solution which is flexible enough to
always fulfill my clients needs (I never say no because of limitations in the implementation) and provides usable web forms, helps me getting rid of those validation and freezing problems, auto-fills form defaults with both static values and those coming from database fields, auto-populates linked fields from databases in a more flexible way than
FormBuilder does now. I'd like to get efficient results and I'm going to consider implementing it in FormBuilder, or at least talk about it with Markus and Justin.
The process
1. build a form (e.g. call functions to add inputs, set <FORM ACTION>)
2. fill in the defaults (with one call or walking through the form inputs by inputs)
3. assign the form template (either a
static template which is created for a specific form thus giving the greatest flexibility or a
dynamic template which describes how to display different field types thus can be applied to any form)
4. parse (and display) the form template
The user fills in the form and posts it to the server. Any time the user posts the form, the server should start with step 5 (so it goes like 5-6; 5-6-7; 5-6-7-8 not 5; 6; 7; 8). This way it is guaranteed that the user gets back the form any time he/she posts invalid values, gets to the confirmation after then (only with valid values that are ready to be processed) and the form is processed only if both the form was valid and it was confirmed (if needed).
5. form validation
6. if the form was not valid, pass it back to the user for correction (go back to step 1 but instead of filling the defaults in step 2, fill it with the values the user just entered)
7. if this form should be confirmed before processing and it wasn't confirmed after the user edited it the last time, pass it back to the user "freezed" (=read-only) for confirmation
8. process the form (this means storing it in a database in most cases)
This flow is what I want to achieve. Additionally, I don't want FormBuilder to generate
anything for me by default, I want to call it multiple times, once for each field that I want to include in the form. This way I can a) render fields in arbitrary order b) add arbitrary fields even to the middle of the form if needed. I didn't talk about this with anyone yet, this is what I feel I need. Let me know what
you need.
I'm looking forward to see your comments on this, it's greatly appreciated.
More reading for those of you who are interested: