dbForm PHP Project
Advanced Demonstration

This is an example of an Advanced form. Try out all of the form actions and see how it works, then scroll down to see the source code and template used.


Person
Search:
 
Source Code

This code is a particularly advanced. However the advanced parts are more in that we are setting attributes of more fields and buttons as well as writing our own functions to process and retrieve data.

You will notice that I am setting alot of attributes. This allows me to be sure that the fields look the way we want.

We are also setting some not null properties on fields. Normally you would not have to do this if your table structure has the not null properties set on the field. But for this example we are setting not null on the fields that we want to be manditory. A javascript message will be displayed when a field fails it's not null check or when it is past its max length.

I also check the forms action and display the accessid field differently.
If adding a new record then the form displays with accessid as a selection list otherwise it displays the accessid as text.

To further implement this I have overridden some of the processing functions.
selectPerson will retrieve the Person data and display the data appropriately.
processPerson will update or delete the person record

While this is a fairly advanced example there is seldom need to go to these lengths to create a form. This example is purely to show the extent to which the code can be used.

View source code for demo3.php

Template File

This template is a bit more advanced than the previous ones but only in that it uses style sheets to layout things out a bit nicer. It also places each field exactly rather than relying on the {:each field} sections used previously.

View source code for demo3.tpl

Download Demo files

The files that have been used in this demonstration can be downloaded so you can try them out for yourself.

demo3.zip