Quoting Tim Howell <[EMAIL PROTECTED]>:

> Do any of you ever create applications that present forms to a user
> based on information entered by a different level of user?  For example,
> in an event registration system I'm writing, a user is required to enter
> different information when registering for an event depending on the
> event specifics.  The event specifics aren't known until the event is
> entered into the system by an administrative user.

If you don't mind looking at PHP code, the open-realty package at
http://www.open-realty.org/ does something like this.  An agent is allowed to
create new form fields for their listings.  These custom form fields are then
dynamically rendered when a user is ading a new listing.

> The way I've handled this is by including fields named Custom1..CustomX
> in the database, and then inserting names in those records if needed.
> If the names are found when the sign-up display screen is shown then
> that information is required for the sign-up.

I usually use a key/value table which allows for an unlimited number of extra
fields to be entered.  The biggest limitation of this is that it makes searching
using SQL much more difficult.

> This works pretty well, but it is a bit limited.  For one thing, it
> currently only allows text field inputs to be entered, and no restraints
> are placed on what data is considered a valid entry.

I usually end up doing my constraint checks at the code level in situations like
this, and don't worry abvout putting integers into text fields.  Again there are
drawbacks, but sometimes concesions need to be made (it is especially difficult
to work with date fields in this case).

Another option is to use a key value table with many columns (one of each type),
and only filling in the appropriate one for each row.  This generates a very
sparse table, and would waste space.  You also need a column that specifies
which one is the active column for the row.

> I'm thinking of extending this, at least in part by including regexen in
> the database to validate input.  I'm trying to figure out a good way for
> administrative users to be able to edit these, though, as they certainly
> aren't familiar with the regexen.

There is always need for compromise when providing the most flexibility while
still keeping the complexity at a minimum.  You should easily be able to allow
for size constraints with numbers and strings, and constraints for dates.  Also,
limiting the input to a given set of values should be easy enough as well (see
the open-realty package for examples of doing this).  However, allowing the user
to enter constraints that are more complex may provide a challenge...

Cheers,

Cees

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to