GUIDED TOUR - PART THREE - choosing editors in:
PHP/MySQL Web Database Application Code Generator Version 10
There are many different types of editors for different types of fields. This is a summary of what each editor does, and when to use it.
-
Standard Text Box
Editor Type: Text Properties -> Type: Standard Text BoxThe Standard Text Box is a simple, familiar text editor.
-
Auto-Complete
Editor Type: Text or Number (Integer) Properties -> Type: Auto-CompleteThe Auto-Complete editor uses Ajax calls to display matching suggestions as you type. When the users sees the value they want, they simply click on it instead of having to type it in full.
The suggestions are populated from another table in the database, defined under Table to Lookup.
-
Upload Fields
Editor Type: Text or Binary (Upload) Properties -> Type: Upload File
Editor Type: Text or Binary (Upload) Properties -> Type: Upload ImageYou can upload images and files, and either store them on the file system, with the filename being stored in a text field, or the file can be stored in a blob (Binary Large Object) field.
Most people recommend storing files on the file system, the ability to store files in the database is only included for completeness.
Image uploads display the image, whilst files are represented by an icon graphic – the user can click on it to download it.
-
Search-Form Lookup

Editor Type: Text or Number (Integer) Properties -> Type: Search FormThe Search-Form field looks like a dropdown list, but when the user clicks on the arrow, it brings up a filterable search form to help the user locate the record they want.
This is particularly useful for customer tables for example. If you have 10,000 customers you don’t want to list them all in a drop down list! Using a Search-Form would allow the user to search by First Name, Second Name, Post/Zip Code etc.
-
Password Field
Editor Type: Text Properties -> Type: PasswordIf you have a table of user records in your database which is used to authenticate users then it is a good idea to set the password field to the password editor. This will ensure that the actual password is not displayed (dots will be shown instead) and the user will be prompted a second time to confirm their choice of password.
You can choose to encrypt the password using either ther SHA1 or MD5 functions. These encrypt the password so that if a hacker gained access to your database, they could not guess the password just from seeing the stored value.
Hackers also use databases of common passwords encrypted so that they can possibly work out the password from the encrypted value. Therefore, you can add a salt value to the field before it is encrypted. The Salt is a random phrase or characters – keep it secret to keep your database secure.
Incidentally, the number of dots in the password field do not reflect the number of characters in the actual password entered. Since it has been encrypted, the value held will always be the same length. If you view source you will see that the value held is “UNCHANGED”.
-
Integer / Decimal Field
Editor Type: Number (Integer)Editor Type: Number (Decimal)The integer and decimal fields uses a javascript function to prevent the user from entering alphabetic characters. The decimal version allows you to specify the number of decimal places.
-
Dropdown List Field
Editor Type: Dropdown ListThe dropdown list field can be populated from a database table, or from a hard-coded list of values which is held in an XML file.
-
Radio Button Field

Editor Type: Radio ButtonThe Radio Button editor shows the list of options specified in a hard-coded list of values which is held in an XML file.
-
Large Text Field (HTML)
Editor Type: Large Text Properties -> Use HTML Editor: Ticked
Large Text Field (Plain Text)
Editor Type: Large Text Properties -> Use HTML Editor: Un-tickedThe Large Text editors are used for text fields in the database and allow large quantities of text to be edited.
You have a choice of plain-text or HTML Editor – which links into the FCKEditor open source Rich Text Editor which contains facilities to change typeface, size, colour etc.
Please Note: FCKEditor is not part of PHP/MySQL Web Database Application Code Generator, it is supported for convenience. If you have any problems with the editor then please check the forums at http://www.fckeditor.com
-
Date Field (Calendar)
Editor Type: Date/TimeThe date editor allows the user to type the date and/or select it from a pop up calendar. It looks at the end users browser country settings and displays the date month and year in the appropriate order for that country.
-
Checkbox Field
Editor Type: CheckboxThe Checkbox field is useful for true/false (tinyint) values.
-
Dual List Field
Editor Type: DualistDual List Editors allow you to handle many-to-many relationships.
For example, in our demonstration DVD database, we want to record the languages available on the DVD – but a normal dropdown list isn’t any good because DVDs often have more than 1 language soundtrack.
The DualList shows all the available values on the left, and the selected ones on the right, with buttons to transfer values between the lists.
When there are too many “available” options to show them all, there is an option to combine it with auto-complete so that the user types in a few letters from the value they want and a list of matching options will be shown.
How does it work?
To associate multiple lookup values in this way, we need a “middle” table – a table that is simply used to link the other 2 tables.
In our example database, we have a table of DVD records called tbldvd, with an identity field called dvdid. There is a language table called tbllanguage with an identity field called languageid. The middle or link table is called lnkdvdlanguage and contains the fields dvdid and languageid.
It may sound complicated if you don’t have a lot of experience with databases, but it’s really quite easy once you get your head around it!
Continue to Guided Tour Part 4 - How to Create a DualList Field