You are here: design patterns with php and ajax « PHP Programming Language « IT news, forums, messages
design patterns with php and ajax

Posted by frothpoker on 11/09/06 20:34

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
pages.

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
integrity)

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
validations:-

Table to validate
Field to validate
can be null
mininum length
max length
positiveallowed
negativeallowed
zeroallowed
undefinedbooleanallowed
validateagainsttable
validateagainstfield

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

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.

Obiron

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация