hey_david has asked for the wisdom of the Perl Monks concerning the following question:
I've been thinking of ways to simplify and automate the development of web form applications, to speed up the process and make them easier to maintain.
I'm thinking of a scheme where once the framework is developed, then for each form, almost all (an exageration) you'd have to do is define your form in a property or XML file. In it might be a descriptor for each field, something like:
If you wanted to use these descriptors to generate the form as well, then perhaps you could add:[field name] type=[text|checkbox|radio|single_choice_listbox|multi_choice_listbox] validation_type=[none|zip|state_abbr|email|phone|date|year|integer|alp +hatext|...] required=[yes|no] dependent_fields=[field_x, ...] choices=[<id:display_name>[,...]] (for choice-type fields. E.g. 1:Blue +,2:Red,...)
WHAT could you do with this?order=<1..n> pre_text=[text], ex: Birthdate: post_text=[text], ex: (e.g. mm-dd-yyyy) start_on_new_line=[yes|no], default is yes size=[no. of characters], default is undefined, only valid if type is +text type maxlength=[no. of characters], default is undefined, only valid if typ +e is text type
- Generate the form on the fly in an html table (which you could say, capture in a string, and pass to a cgi print statement or a template, for example). Includes filling in listboxes and such with static values.
- Check for required input, and mutually dependent field input
- Validate form fields. The above validation_types would reference into a set of validation objects, be they home-grown or from existing validation modules
- Submit data into a given database table (using a one-to-one mapping between form fields and table columns)
- Retrieve data from the same table and fill-in the form when desired.
- And if you wanted separate database tables for the static choice values associated with listboxes, checkboxes, etc., you could run a script at installation time that would read this property file and create the database tables, with suitable key constraints.
I realize there are some issues to settle, e.g. better ways to separate the model of the data from its view, and ways to make it extensible.
I also realize I cannot be the first person to have thought of something like this (or something much better, no doubt).
Good monks, before I plunge down this path, let me learn from your insight and experiences. Your comments, suggestions, and/or links to other posts would be greatly appreciated.
Thanks!
David
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Developing Web Form / Database Apps Faster, Better
by Enlil (Parson) on Oct 13, 2003 at 22:46 UTC | |
|
Re: Developing Web Form / Database Apps Faster, Better
by etcshadow (Priest) on Oct 14, 2003 at 00:47 UTC | |
|
Re: Developing Web Form / Database Apps Faster, Better
by bradcathey (Prior) on Oct 14, 2003 at 01:09 UTC | |
by chimni (Pilgrim) on Oct 14, 2003 at 06:36 UTC | |
by hey_david (Sexton) on Oct 17, 2003 at 21:13 UTC |