design patterns with php and ajax

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Hi guys, hope you can help me here...

i am building a new on-line application unsing  L.A.M.P. and ajax.  I
have a number of static tables which need to be maintained and want to
try to cut down the amount of coding to do on building maintenance

All forms will recall or create a single record in a table.  The table
will always have a unique key of one field which will always be the
first field in the record.  The record could have an indeterminate
number of fields and the fields could be of any type.  In most cases no
fields will be dependent on other tables (ie no need for referential

So as an example:-

one table will be offer:

Offer ID (string)
Offer Description (string)
Active Start Date (date, required)
Active End Date (date, required)
Dicount percentage (short integer, restrict to positive value only)

Another table will be delivery Method
Method ID (string)
Method Description (string)
Price (decimal 3.2, restrict to positive values only)
Vatable (boolean)

I want a programming construct that allows me to write a single group
of functions to produce the relevant forms.  I don't need code
(although it would be nice :-] )  but am looking for guidance on how to
auto-build the forms and carry out any additional validation.

Ideas for managing this include:-

using describe table to get the field names, types and not null status
and traverse the results to build the form.  Hold details of any
additional validation that needs to be done in a separate table for

Table to validate
Field to validate
can be null
mininum length
max length

Using an XML data file to define tables, fields, restrictions and

or is there an easier way.

I want to be able to do most of the validation client side using
javascript functions but will build in the event handlers when I create
the innerHTML using Ajax and php.


Site Timeline