You are on page 1of 105

CUESTIONES GENERALES

What's New in PHPMaker 10

PHPMaker 10 is a major upgrade from 9.x. It is loaded with a bunch of new features, including many frequently requested
ones. PHPMaker 10 is probably the most powerful and flexible product of its kind, and yet still easy-to-use as always.

New Website UI with Bootstrap


Brand-new generated website UI with Bootstrap:

Implementations:
Tooltip by Tooltip and Popover
Search Panel by Collapse
Numeric Pager by Pagination
NextPrev Pager by Button groups and Icons
Add Option Dialog, Export to Email Dialog and JavaScript Popup Message by Modal
Server side message by Alert
AutoSuggest by Typeahead
Vertical Menu by Dropdown
Multi-Page as Tabs, Pills or Accordion

Tabs

Pills

Collapses(Accordion)
Vertical Menu and Horizontal Menu

Vertical menu

Horizontal menu by Horizontal Menu extension (for


registered users only)

Enhanced Theme with Bootstrap Variables


Allow customizing Bootstrap variables right in the UI:

Breadcrumb
Provide links back to previous pages, including master table.
Master/Detail View/Edit/Copy with Multiple Detail Tables
Now you can add/copy/edit/view a master table with multiple detail tables in the same page:

Referential Integrity
Supports Referential Integrity (enforce foreign key points to a valid record in the master table), Cascade Delete and
Cascade Update
Different Styles of Links in List Options, Export Options and Paging Section

Links with icons

Button group

Button dropdown

Button group in paging section

Button dropdown in paging section

Enhanced Detail Preview Extension (FRU)


Preview Overlay, Preview Row, or even both.
Multiple File Upload to Folder
Allow upload multiple files to folder (NOT to database)

Custom Locale Settings


Use your own locale settings easily:
Custom View Tags
5 ready-to-use Custom View Tags for you to display your data visually:
Flash Files
Google Maps
Barcode
QR code
YouTube videos

LESS - The Dynamic Stylesheet Language


Supports LESS which extends CSS with dynamic behavior such as variables, mixins, operations and functions.

More Server Events


Lookup_Selecting - Fired before selecting records from the lookup table. For customizing lookup table filter
dynamically.
Page_Rendering and Page_Render - Fired before outputting HTML of the page. For making some last minute
changes to the page before it is outputted.
Row_CustomAction - Fired for each selected row (by checkboxes) to process the custom action (similar to Multi-
Delete and Mulit-Update)

More Advanced Settings


Compress project .css - Compress the project stylesheet (i.e. <project>.css) and output minified .css file
Compress project .js - Compress the project JavaScript file (i.e. ewp<version>.js) and output minified .js file.
Validate NOT NULL fields - Detect fields declared as NOT NULL in the database (and without default value in
database or the project) and force "Required" validation.
Use datenumber.js - Include YUI date and number library to operate against Date objects and Number objects.
Oracle charset - Set alternative charset (other than the project charset) of connection object for Oracle.
Use View Tag number of decimal digits for edit - Neglect original precision of a decimal number and use specified
number of decimal digits in Edit page.
Replace textarea by text input for search - Use text input in search forms for field with TEXTAREA Edit Tag.
Reflow HTML elements for mobile - Stack form elements vertically for mobile
Use place holder for text box - Automatically set placeholder attributes of form elements as the field's caption or
title
More
YUI replaced by jQuery and Bootstrap components
Styling by CSS
Id and CSS classes added to many HTML elements for easier styling by CSS or jQuery
Paging section in Edit page
jQuery and jQuery Mobile updated
JsRender updated
New stylesheet for JsCalendar to match Bootstrap style
Sequence number option for List page
tinyMCE and CKEditor extensions (for registered users only) updated with latest versions (FCKEditor extension not
provided any more)
FileManager for CKEditor extension (for registered users only)
PHPExcel extension (for registered users only) updated
mobile_detect.php updated
"Ends With" search operator
One more font for Captcha extension
100% site height
Password Recovery security improved
System requirement updated to PHP >= 5.2
Many other minor improvements

System Requirements

PHPMaker
Windows XP/2003/Vista/2008/7/8
PHPMaker requires the following system files. If you do not have latest version of these files, you may experience ActiveX
errors. To update your system, go the Microsoft download pages listed below.
Service Pack 6 for Visual Basic 6.0: Run-Time Redistribution Pack (vbrun60sp6.exe)
Microsoft Windows Script 5.7 (Windows XP)
Microsoft Windows Script 5.7 (Windows Server 2003)
MSXML Parser 3.0
IIS Express (only required if you want to use IIS Express as testing web server)
If you use Microsoft Access, SQL Server or Oracle, PHPMaker requires the following database drivers to connect to the
database:
Microsoft Data Access Components (MDAC) 2.8 (for Microsoft Access, SQL Server and Oracle)
Microsoft Jet 4.0 Service Pack 8 (SP8) (for Microsoft Access <= 2003)
2007 Office System Driver: Data Connectivity Components (for Microsoft Access 2007)
Microsoft Access Database Engine 2010 Redistributable (for Microsoft Access 2010)
Microsoft SQL Server 2012 Native Client (X86 Package) (for Microsoft SQL Server 2005/2008/2012)
Oracle Client (for Oracle)

Server
Linux/Unix (MySQL/PostgreSQL/Oracle) or Windows (MySQL/PostgreSQL/Access/MSSQL/Oracle) web server
PHP >= 5.2

Browser
IE 9+, Chrome/Firefox/Safari/Opera (current stable version and the version that preceded it)
Installation and Uninstallation

important Before you install PHPMaker, you must log in Windows as an user with administrative privileges.

PHPMaker 10 can co-exist with previous version of PHPMaker. You do NOT need to uninstall previous version of
PHPMaker if you don't want to.
Double-click on the downloaded installer to start the installation process. Follow the prompts and change the settings
whenever necessary.
To uninstall PHPMaker, go to [Control Panel]. Click [Add/Remove Programs] and select [PHPMaker 10].

Note for Windows Vista/7/8 (or later) users:


In Windows Vista/7/8 (or later), User Account Control (UAC) is enabled by default, members of the administrators group do
NOT have full administrator privileges.
When you install (by double-clicking the installer or right-clicking the installer and choose Run as administrator), an User
Account Control prompt may be displayed and ask you if you allow the program to make changes to your computer, click
Yes to let the installer run elevated.
If you still cannot install successfully, log in Windows as the built-in administrator account to install. The built-in
administrator account is disabled by default, you may need to enable the built-in administrator account first:
1. Login as administrator. Open a command prompt (under All Programs -> Accessories) in administrator mode by
right-clicking and choosing Run as administrator,
2. Type the command: net user administrator /active:yes. You should see: "The command completed successfully."
3. Log out. You'll now see the Administrator account show up on the login screen.
Log in as the built-in administrator and install again. After successful installation, if you want to disable the built-in
administrator account. Logout and re-login as your regular user account, and then open an administrator mode command
prompt as above. Type the command: net user administrator /active:no. The administrator account will now be disabled, and
should not show up on the login screen anymore.

Third-party Tools

Note
All the following tools are not developed by the author of PHPMaker and are not part of PHPMaker, NO TECHNICAL
SUPPORT WILL BE PROVIDED.

PHPMaker uses the following third-party tools in template/extensions:

CKeditor
Website: http://ckeditor.com
CKEditor is distributed under the MPL Open Source license. If IE, requires IE >= 9.

JSCalandar
Website: http://www.dynarch.com/projects/calendar/old

PHPMailer
Website: http://phpmailer.sourceforge.net

DOMPDF
Website: http://code.google.com/p/dompdf
Requires MBString and DOM extensions.

WARNING!
This extension is EXPERIMENTAL only. There are some known issues of DOMPDF, please read the developer website
for more information. Known issues includes (but now limited to):

not particularly tolerant to poorly-formed HTML input


large files can take a while to render
use a lot of memory

jQuery and jQuery Mobile


Website: http://jquery.com/

JsRender
Website: https://github.com/BorisMoore/jsrender

Bootstrap
Website: http://getbootstrap.com/2.3.2/

Barcode
Website: http://www.phpclasses.org/package/2441-PHP-Generate-barcode-graphs-using-different-standards.html

QR Code
Website: http://phpqrcode.sourceforge.net/

Additional extensions: (FRU)

Note Additional extensions are provided for registered users as examples of customzing and extending template only,
NO TECHNICAL SUPPORT WILL BE PROVIDED. Registered users will be provided information to download the
extensions. These tools will NOT automatically work with PHPMaker without the extensions.

Horizontal Menu
Replaces the graphical extension for previous versions. Uses Bootstrap Navbar as horizontal menu.

TinyMCE
Website: http://tinymce.moxiecode.com If IE, requires IE >= 9

PHP Thumb
Website: http://phpthumb.gxdlabs.com
Supports GIF, JPEG and PNG images only. Requires PHP GD2 extension.

PHPExcel
Website: http://phpexcel.codeplex.com
Requires PHP version 5.2.0 or higher, PHP extension php_zip enabled (for Excel2007 format), PHP extension php_xml
enabled and PHP extension php_gd2 enabled (if not compiled in).

Detail Preview
Allow previewing detail records in an expanded row of the main table in List page, and/or in a popup overlay by Bootstrap
Popover.

Scrollable Table
Scrolling table example. Enable X/Y scrolling of the main table in the List page. If IE, requires IE >= 9.

CAPTCHA
Generates CAPTCHA image. Requires PHP GD extension with GD2.

Introduction to PHP and MySQL

What is PHP?
PHP is a widely-used general-purpose server-side scripting language that can be embedded into HTML. You can think of it
as a "plug-in" for your Web server that will allow it to do more than just send plain Web pages when browsers request
them. With PHP installed, your Web server will be able to read a new kind of file (called a
) that can do things like retrieve up-to-the-minute information from a database and insert it into a Web page before sending
it to the browser that requested it. PHP is completely free to download and use. If you are new to PHP and want to get
some idea of how it works, try the introductory tutorial.
PHP Home Page
Manual
Download

What is MySQL?
MySQL is a relational database management system, or RDBMS. It has become the world's most popular open source
database because of its consistent fast performance, high reliability and ease of use. PHP has MySQL extension which
makes it really easy to access data in MySQL.
MySQL Home Page
Manual
Download

Useful MySQL Database Administration Tools


phpMyAdmin (freeware)

Installing PHP and MySQL on Windows


Both PHP and MySQL support various platforms, including Windows. It is recommended that you install MySQL and PHP
on your computer so you can easily develop and test your PHP locally before uploading to your production server.
If you use Internet Information Services (IIS), you can install PHP on your Windows system PHP for Windows
which installs PHP for IIS, it configures the web server as well. Alternatively, you can use Microsoft Web Platform Installer,
see http://php.iis.net/.
If you do not have IIS, you can use other Web server such as Apache. If you have difficulties installing PHP and MySQL,
you might as well try EasyPHP which is an "out of the box" Apache, MySQL, and PHP installation for Windows.
Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution
and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH.
The next step is to set up a valid configuration file for PHP, the php.ini. PHP searches for php.ini in the locations described
in The configuration file..
Note: If you're using NTFS on Windows, make sure that the user running the web server has read
permissions to your php.ini (e.g. make it readable by Everyone).

Some Important Settings in php.ini for Using PHP on Windows


extension_dir - In what directory PHP should look for dynamically loadable extensions. It should be set to the folder where
your extensions are installed, , e.g. extension_dir="C:\Program Files (x86)\PHP\ext"
session.save_path - This is the path where session data files are stored. Make sure this setting points to an existing folder
on your machine, e.g. session.save_path="C:\Windows\Temp"
Note: If you're using NTFS on Windows, make sure that the user running the web server has write
permissions to this folder (e.g. make it readable and writable by Everyone). See the section Configuring
Permissions below.
upload_tmp_dir - If you want to use file upload, make sure this setting points to an existing folder on your machin, e.g.
upload_tmp_dir="C:\Windows\Temp"
Note: If you're using NTFS on Windows, make sure that the user running the web server has write
permissions to this folder (e.g. make it readable and writable by Everyone). See the section Configuring
Permissions below.
php_com_dotnet.dll - If you use MS Access or MS SQL Server (on Windows server), the COM extension is required. As of
PHP 5.3.15 / 5.4.5, the COM extension requires php_com_dotnet.dll to be enabled inside of php.ini, i.e.
extension=php_com_dotnet.dll
Note: Also make sure you have installed the php_com_dotnet.dll in the extension folder (extension_dir)
specified in php.ini.

Internet Information Services (IIS)


IIS 7.0 or 7.5 is included with Windows Vista/2008/7 and is installed via Programs->Turn on or off Windows features in
the Control Panel. Read:
http://www.iis.net/learn/install/installing-iis-7/installing-iis-on-windows-vista-and-windows-7
IIS 6.0 is included with Windows Server 2003 and is installed via the Add or Remove Programs item in the Control Panel.
IIS 6.0 installs in a highly secure state, serving only static HTML content until other features and file types (such as PHP
and ISAPI) are enabled. PHP must be enabled in IIS version 6.0. To enable PHP by using IIS Manager, expand the local
computer, and then click Web Service Extensions. In the details pane, click php, and then click Allow.
Creating Virtual Directories in IIS 7 (Windows Vista or Later)
The IIS manager user interface consists of three panes.

The left hand side pane is Connections, the middle pane is Workspace and the right hand side pane is Actions.
The Connections pane lists application pools and websites. The workspace pane consists of two tabs at the bottom namely
Features View and Content View. The Features View allows you to work with the settings of the selected item from
Connections pane whereas the Content View displays all the child nodes (content) of the selected item.
Application pool is a group of IIS applications that are isolated from other application pools. Each application pool runs in
its own worker process. Any problem with that process affects the applications residing in it and not the rest of the
applications. You can configure application pools individually.
In order to create a new application pool, select "Application Pools" under Connections pane. Then click on "Add
application pool" from Actions pane. This will open a dialog as shown below:

Specify a name for the new pool to be created. Select .NET framework version that all the applications from the pool will
use. Also select pipeline mode. There are two pipeline modes viz. integrated and classic. The integrated mode uses the
integrated request processing model whereas the classic mode uses the older request processing model. Click OK to
create the application pool.
Your new application pool will now be displayed in the Workspace pane. To configure the application pool click on the
"Advanced Settings" option under Actions pane. The following figure shows many of the configurable properties of an
application pool.
If you use 64-bit Windows, set Enable 32-Bit Applications to True. (See Running on 64-bit Windows Operating System
below.)
To create a new web site, select Web Sites node under Connections pane and then click on "Add Web Site" under Actions
pane. This opens a dialog as shown below:

Here, you can specify properties of the new web site including its application pool and physical location.
Creating an IIS application or a Virtual Directory is quick and simple. Just right click on the web site and choose either
"Add Application" or "Add Virtual Directory" to open respective dialogs (see below).
An existing Virtual directory can be marked as an IIS application by right clicking on it and selecting "Convert to
Application".
If you use IE, you may encounter the following error messages when you run PHP pages with IIS 7:
An error occurred on the server when processing the URL. Please contact the system administrator.
Go to Internet Options -> Advanced, disable Show friendly HTTP error messages.

Configuring Permissions
An important aspect of working with file upload to a folder on the Web server is to correctly configure permissions.
When a Web application uses a file, the application must have Read permission to the file so the application can access
the data. Additionally, the application must have Write permission to the folder that contains the file. Write permission is
required because the file may be created at run time.
If you use Linux/Unix, CHMOD your upload folder to "777" by using your FTP software.
To use an Access database in an PHP Web application, you must configure the folder that contains the Access database
to have both Read and Write permissions for the IIS user account.
The default anonymous IIS user depends on IIS version. In IIS 5, it is IUSR_<MachineName>. In IIS 6 and IIS 7 it can be
NETWORKSERVICE or IUSR. In IIS 7.5 it depends on Application Pool, read Application Pool Identities for detail.
To set permissions in the folder (if you're using NTFS on Windows),

1. In Windows Explorer, move to the root folder for the Web site. e.g. C:\Inetpub\wwwroot\ExampleSite.
2. If the folder does not already exist, create one.
3. Right-click the folder, click Properties, and then click the Security tab.

4. Under Group or user names, look for or add the user.


5. Verify that the account has Read and Write permissions for the folder.

Similarly, set permissions in the folder where the audit trail log file reside.

Running on 64-bit Windows Operating System


Windows Server 2008 or Windows 7 64-bit (IIS 7.x)
On 64-bit Windows 2008/7, IIS 7.x can run both 32-bit and 64-bit worker processes simultaneously. To run 32-bit Web
applications in IIS 7.x on 64-bit Windows all it needs is to assign the 32-bit applications to a separate application pool in IIS
and turn on the Enable 32-Bit Applications switch for that application pool. To do this, open IIS Manager, open
Application Pool, select the application pool, and then click Advanced Settings. In Enable 32-Bit Applications, select
True.

Windows Server 2003 64-bit (IIS 6)


On 64-bit Windows 2003, although IIS 6 supports running both 64-bit and 32-bit worker processes, it doesn't support
running in both modes simultaneously. By default IIS 6 is configured to run in native 64-bit mode and work only with 64-bit
worker processes, which means you can only run 64-bit Web applications (for ASP.NET applications they can only target
ASP.NET version 2.0 or higher) in the native mode. In order to run 32-bit Web applications you will need to set IIS 6 to run
in 32-bit mode. Note: This means all your Web applications will now run in 32-bit mode.
To enable IIS 6 to run 32-bit worker processes follow these steps:

1. Open a command prompt and navigate to the %systemdrive%\Inetpub\AdminScripts directory


2. Type the following command:
cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 "true"
3. Press ENTER
4. Afterwards restart IIS by using the iisreset command from the command-line
The following article explains the details of the changes in the behavior of IIS after configuring it to run 32-bit worker
processes: Running 32-bit Applications on 64-bit Windows (IIS 6.0)

Quick Start

PHPMaker connects to your database, extracts tables and fields information, and generates PHP scripts instantly based
on these information. For each table, it will generate a list page, add/copy page, view page, edit page, delete page and
search page all linked up properly.
To generate scripts, you just need to follow the tabs and setup the options, that is:
[Database] > [PHP] > [HTML] > [Security] > [Generate]
However, if you are a first time user, we recommend you to generate a basic PHP application and get to know how
PHPMaker and PHP works first.

Note If you have not used PHP before, it is recommended that you read Introduction to PHP and MySQL first.

To generate your first PHP project, you can skip the options and use default settings first. In other words, you skip the
intermediate steps and go directly to the [Generate] tab after connecting to your data source, that is:
[Database] > [Generate]
You can generate the web site quickly by the following steps:

1. Start up PHPMaker. There are two connection methods to connect to your MySQL server - DIRECT or URL. As
explained in Introduction to PHP and MySQL, it is recommended that you have a local MySQL server during
development. You usually connect to MySQL by the DIRECT method, the URL method is only used when you want
to conenct to a remote MySQL server which does not allow direct connection. (See Tutorial - Connecting Remote
MySQL using PHPMaker Connection Script.)
2. In this example, we use direct connection. Enter connection details for the MySQL Server .

3. Click the [Connect] button to load the database information. Tables and fields information will be loaded and
displayed on the left hand side.
4. Click the [Generate] tab and select the follows:

Template file - The zipped file that contains the template of the generated pages. Just use the default template is
shipped with PHPMaker.
Application root folder - The root folder of your PHP application. (See Application Root)
Destination folder - The folder that the generated scripts will reside. This can be same as the application root folder or
a subfolder under the application root folder. In this case, we use the same folder for simplicity.
To run PHP you need to setup a website or virtual directory (See Introduction to PHP and MySQL ). If you are not
familiar with web server, you can install IIS Express which can be downloaded from Microsoft website. Then select
[IIS Express] and [Browse after generation] in PHPMaker.

5. Click the [Generate] button, the generation process will begin. After the web site is generated successfully, a
completion message will be displayed. The web site should then be ready to run. If [Browse after generation] is
enabled, PHPMaker will open your browser, and - voila! - you'll see PHP displaying the data in your first PHP
website.

After understanding how it works, you can then take advantages of various other options provided by PHPMaker and setup
your project more precisely. See Project Setup for full details.
PROJECT SETUP
To make use of the various features of PHPMaker and create scripts that best suit your Web sites, read the following
information and get to know the options PHPMaker provide. It is assumed that you have basic knowledges of HTML and
PHP and the technical terms are used without further explanation. To generate a Web site, please perform the following
steps:

1. Database
2. PHP
3. HTML
4. Security
5. Generate

To further control the functionality of the generated scripts, you can setup different options for each table/field:
Table Setup
Field Setup
You can also setup additional database objects for your project in PHPMaker:
Custom View
Report

Database Setup

If you are not at the [Database] tab yet, clicking the icon in the toolbar to go to [Database] tab. PHPMaker can connect
to MySQL, PostgresSQL, Microsoft Access and Microsoft SQL Server.

1. MySQL
Select MySQL as database type.

There are 2 connection methods you can choose:

Direct Connection (default)

1. Enter your database host/server name (or IP address), username, password and port number (default is 3306 for
MySQL),
2. Select your database,
3. Select the SQL Identifier Quote Character, default is backquote (`) for MySQL,
4. Click the [Connect] button to load the database information.

Note The server name or IP should be valid on your production Web server also. Otherwise you'll need to modify the
generated connection info in ewcfg*.php before you upload it to your production server. For example, if you have a testing
MySQL Server installed on the same computer, you can use "localhost" as server name when you connect to it with
PHPMaker. The generated scripts will then try to connect to a MySQL Server on the same computer as the production
Web server, if this is not the case, the connection will fail.

URL Connection (for remote database)


While the direct connection method is quick and easy, some remote MySQL server may not allow direct connection.
PHPMaker provides an alternative simple way to connect remote servers:

1. Upload the PHP connection script provided by PHPMaker to your site. Note that:

a. The script is named "phpmaker.php" and can be found under your installed folder, usually C:\PHPMaker,
b. Always use the script shipped with your version of PHPMaker. PHPMaker may not work with script
shipped with previous versions.

2. If it is the first time that you use this script, you may want to test the script with your browser:

a. Browse to this script with your browser,


b. Enter the connection info,
c. Click "Get Database List" and then "View Schema", you should be able to view the schema of your database in
XML properly. Now go back to PHPMaker.

2. Enter the SAME connection information, select URL for connection method, enter the URL of the script (e.g.
http://servername/path/phpmaker.php), you can test the URL by clicking the [Test] button,

3. Click the [Connect] button to load the database information. PHPMaker will connect to the database server
through the PHP script over HTTP.
2. Microsoft SQL Server (Windows only)

Note If you use SQL Server 2000/2005/2008/2012 and have installed SQL Server 2012 Native Client on your computer,
then Microsoft SQL Server and Microsoft SQL Server 2005/2008/2012 database type will be available for selection. You
can use this database type for connection to SQL Server 2000, 2005, 2008 or 2012. You can download SQL Server 2012
Native Client from the Microsoft website. See System Requirements. The native client must also be installed on the web
server. (ODBC connection is not recommended and not supported.)

Select Microsoft SQL Server (or Microsoft SQL Server 2005/2008/2012 if you use SQL Server 2005/2008/2012
or later) as database type,
Enter the name or IP of the SQL server,
Enter the User ID and Password,
Select the database you want or just enter the name of your database,
Click the Connect button to load the database information.

Notes

1. If Microsoft SQL Server 2005/2008/2012, make sure the server name includes the instance name, e.g.
localhost/SQLEXPRESS.
2. The server name or IP should be valid on your production Web server also. Otherwise you'll need to modify the
generated connection string in ewcfg*.vb/cs before you upload it to your production server. For example, if you
have a testing SQL Server installed on the same computer, you can use "(local)" as server name when you
connect to it with ASP.NET Maker. The generated scripts will then try to connect to a SQL Server on the same
computer as the production Web server, if this is not the case on the server, the connection will fail. It is common
that SQL Server is installed on a different server in production environment.

Load from PMP Project File


If you previously saved your project file (.pmp file), you can load it back by clicking the open button on the tool bar (or
select "Project", "Open" from the menu bar). At completion, the tables and fields information will be loaded and displayed
on the left pane.
The database pane is dockable. If you prefer to display the database pane on the right hand side, simply drag it to the right
side.

SQL Identifier Quote Character


Most databases support quoting of identifiers (database, table, and field names) with a character. If the identifier is a
restricted word or contains special characters or spaces you must always quote it with the quote character. In most cases,
you do not need to change this setting, PHPMaker will use the default quote character for your databases. However, if for
some reason you need to specify it explicitly, select the [SQL Identifier Quote Character] that suits your case.

Dynamic Table Loading


By default all tables in the database are loaded. It is convenient but loading and sychronization could be slow if your
database contains a large number of tables or fields. If this option is enabled, a table will only be loaded when you select it
in the database pane. If you just use a few tables out of a large database, this feature enables you to work much faster
than before. To enable this feature, simply check [Load tables dynamically] BEFORE pressing the [Connect] button.
PHP Settings

General Options

Add shell cal


(For Unix-based server only) If you put the PHP parser binary somewhere outside of the web tree of files, for example, in
/usr/local/bin, you will have to put a line similar to: #!/usr/local/bin/php as the first line of any file containing PHP tags. (You
will also need to make the file executable.)

Set locale
Set locale information. PHPMaker uses localeconv() which returns data based upon the current locale as set by
setlocale().
Different systems have different naming schemes for locales.
If you do not know the correct locale string on your server or you want to override system locale and use your own locale
settings, click the [...] button and enter your locale settings.
Refer to localeconv() for the definition of the settings.

Note If you use Multi-Language (see below), DO NOT use this setting unless all languages share the same locale
settings. Each language has its own locale settings and you should specify locale settings for each language in the
respective language file. (See Customizing Template)

No Cache
Whether caching is required on browser

Use mysqli extension


Use mysqli extension instead of MySQL functions.

Notes

1. The mysqli extension is designed to work with PHP 5 and MySQL 4.1.3 or above,
2. Both mysql and mysqli extension are NOT installed by PHP 5 by default. (See Introduction to PHP and MySQL)

Default Date Format


The default date format for the scripts. Possible values are:
yyyy/mm/dd, mm/dd/yyyy, dd/mm/yyyy,
yyyy-mm-dd, mm-dd-yyyy, dd-mm-yyyy,
yyyy.mm.dd, mm.dd.yyyy, dd.mm.yyyy
with or without time (hh:mm:ss). The selected date format also determines the date separator ("/" or "-" or ".").

Multi-Language
Enable multi-language project. If enabled, a combobox will appear on the top of the generated scripts for user to select
language. See Tools for selecting languages for the multi-language project.

Important :

1. Multi-Language project must use utf-8 encoding. The charset of the project must be "utf-8".
2. The data in your database must be stored in unicode, otherwise your data will not be displayed properly.
3. If you have customized the template and put unicode characters in the template directly instead of using language
files, enable the Advanced Setting UTF-8 output files (see Customizing Template and Tools).
Default Language
Default language of the project. It must be compatible with Charset (see HTML Settings). Default is English.
There is always one default language for a project. Only the English language file (english.xml) is shipped with PHPMaker.
If your project is single language but you use another language, create a language file for your language (see Customizing
Template), put it in the "languages" subfolder under the installation folder and then select your default language using this
combobox.
If you enable Multi-Language, you must select one of the selected languages as the default language.

File Upload

Upload folder - The global folder where the uploaded files resides. If you do not enter a specific folder for a file upload
field in the Edit Tag panel of the Field Setup page, all the uploaded files will be put in this folder.
Important Always specify an upload folder if you allow file upload. This folder is used as the root folder of temporary
folders for file upload fields during Add/Edit. It is also used as the root folder of the user files folder of CKEditor.

Notes

1. Unlike the field specific upload folder setting (which is a PHP expression), this field specific setting must be a
constant string (without double quotes). If you want dynamic upload folders for different fields, specify upload folder
for each field (see Field Setup).
2. Make sure that the Web server user have read/write access to the folder.
3. The path is relative to application root. Use slashes "/" as path delimiter, no leading slash. e.g. If the application
root of your website is C:\Inetpub\wwwroot\demo and you enter "uploads/" in this textbox, the folder for the
uploaded files will be C:\Inetpub\wwwroot\demo\uploads. If you are not sure which folder is application root, please
read Application Root.

Max File Size - Maximum file upload size in bytes. If <= 0, there is no checking on file size.

Notes File upload also depends on your PHP, web server and database configuration:

1. PHP - Check your php.ini, related configurations are file_uploads, upload_max_filesize, upload_tmp_dir,
post_max_size, max_input_time, memory_limit, and max_execution_time directives in php.ini.
2. Apache - If you use Apache web server, check LimitRequestBody directive.
3. MySQL - Check the max_allowed_packet setting in your MySQL configuration.

Allowed file type - The allowed file extensions of the uploaded files. Separate the file extensions (without ".") by comma,
e.g. gif,png,png) If blank, all file types are allowed.
Delete file on update/delete - Option to delete the uploaded file when the field value is replaced, removed or if the record
is deleted.
Audit Trail

You can choose to log activities in a log file or in a database table.


Log file folder - The folder where the audit trail log file resides.

Notes

1. Make sure that the Web server user have read/write access to the folder.
2. The path is relative to application root. Use slashes "/" as path delimiter, no leading slash. e.g. If the application
root of your website is C:\Inetpub\wwwroot\demo and you enter "uploads/" in this textbox, the folder for the log file
will be C:\Inetpub\wwwroot\demo\uploads. If you are not sure which folder is application root, please read
Application Root.

Use database table - Log the activities in the specified table instead of log file. The table must have the following fields:
(actual data types depend on database type)
DateTime (DateTime)
Script (VarChar)
User (VarChar)
Action (VarChar)
Table (VarChar)
Field (VarChar)
KeyValue (Long VarChar)
OldValue (Long VarChar)
NewValue (Long VarChar)
You can create the database yourselves and select the table in the combobox, then click the [...] button to select the fields
in your table. Alternatively, if you have not created the table yet, you can click [Create Table] and let PHPMaker creates
the table and setup the settings for you.
Track login/logout activities - If security feature is enabled, login/logout activities will also be logged.

Validation

Server-side - Enable server-side form validation.


Client-side (JavaScript) - Enable client-side form validation.

Note If the available validation format in the Edit Tag panel (see Field Setup) does not fulfil your requirements, you can use
your own server-side and/or client-side validation code using Server Event and Client Scripts.
List/View Page Options (Global)
The following list/view page options are global for all tables. If you want different settings for a particular table, you can use
table-specific options available in the Table Setup page.

Records per page


Number of records to be displayed on the list page of all tables. If blank or 0, default setting of 20 will be used.

Selectable page sizes


Number of records to be selected by user. Comma separated values, e.g. 10,20,50,ALL.
Note "ALL" (without quotes) is supported, other values must be integers.

Paging section style


"NumericPages" or "NextPrev"

Sort type
None, Single column or Multiple column. If Multiple column is selected, the generated list page supports multi-column
sorting by Ctrl-clicking the table header.

Multiple column
Show multiple records per row. Default is 0. This feature will only take effect if the value is > 0.

Paging section at top


Show the paging section at top (also applies to View page)

Paging section at bottom


Show the paging section at bottom (also applies to View page)
Paging section in View page
Show paging section in View page also

Paging section in Edit page


Show paging section in Edit page also

Multiple delete
Show checkboxes in the list page for selecting multiple records to delete

Inline delete
Delete records directly without showing delete confirm page

Links on left side


Show the links in record row on the left instead of right

Use buttons as links


Show the links in record row as a button group instead of individual icons or links.

Use button dropdown for links


Show the links in record row as a button with dropdown menu instead of individual icons or links.

Use button dropdown in paging section


Show the links in paging section as buttons with dropdown menu instead of individual links.

Export
Enable export in List page - allow export in List pages
Enable export in View page - allow export in View pages also
Use button dropdown - show the export links as a button with dropdown menu. Default is showing the export links as a
row of icons.
Print/CSV/HTML/Excel/Word/XML/PDF/Email - Records can be exported to Print (printer-friendly), CSV, HTML, Excel,
Word, XML, PDF format or sent as HTML email content.

Note The fields in printer friendly version are same as in List/View page, while the fields in other format are determined by
the Export setting of the field in Field Setup page.

Note that the fields in printer friendly version are same as in List/View page, while the fields in other format are determined
by the Export setting of the field in Field Setup page.
Export type - Determines which records to export. The follows are supported:
All Pages - Records in all pages are exported
Current Page - All records in current page are exported
Selected Record - If selected, a checkbox will be displayed in each row for selection. Only selected records in the
current page are exported. (Selecting records in different pages is not allowed.) To select records primary key is
required, Current Page export type will be used for tables without primary key.

Notes

1. Binary data (BLOB fields) cannot be exported.


2. Export to HTML/CSV/XML/PDF are not applicable to reports.
3. Images cannot be exported to Word/Excel/CSV/XML.
4. Export-to-XML requires PHP DOM (part of PHP 5 core).
5. Export-to-Word/Excel works by exporting data in HTML format for Word/Excel to convert/import, the exported file is
not native .doc/.xls format. (Registered user can use the PHPExcel extension which output native Excel file format.)
6. If Export-to-Email, the user can select sending the records as URL or HTML. If sending URL only, note that the
recipient will need to click the URL and go to your site to view the records. All security settings will apply, the
recipient may need to login. If the recipient is not an user of your website and your page is protected, you should
send by HTML only.
Notes (Export to PDF)

1. The extension is an experimental extension only. There are known issues, see Third-party Tools and read the note
in the extension setup page (see Tools -> Extensions) for more information before use. Only enable it if necessary.
2. The extension performs best if you are using non-unicode alphanumerical characters (e.g. iso-8859-1) only. If you
use unicode, configure advanced settings for the extension, read the note in the extension setup page (see Tools -
> Extensions) for more information.
3. By default export is only enabled in View page. If you want to enable it in the List page also (the number of records
to be exported is not large), you can set the advanced settings of the extension (see Tools -> Extensions).
4. The extension supports images (jpg, gif and png only), but a temporary folder is required during export, the
extension uses the Upload folder (see File Upload above) because write permission for the folder should be
already setup properly. If you do not use file upload to folder, but you use export to PDF with images, then make
sure you still specify an upload folder and set up the write permission.

Email Settings
PHPMaker supports many features that can send emails. If you use these features, you'll need to specify a SMTP server.
Note From v9, PHPMailer (see Third-party Tools) is always used as the email component. Make sure you generate and upload
the subfolder named "phpmailer<version>" to your website.

SMTP server
The host name or IP of the SMTP server.

Note Some servers do not support "localhost" as SMTP server, in such case you need to specify a valid SMTP server in
the network.

SMTP server port


Port number of SMTP server. Default is 25.

SMTP server username


User name for SMTP server authentication. If your SMTP server does not require authentication, leave it blank.

SMTP server password


Password for SMTP server authentication.
If your SMTP server does not require authentication, leave it blank.

Sender (Email address)


Email address of the sender of all emails

Recipient (Email address)


Email address of the recipient(s) for notification emails when a record is added/edited/deleted (if enabled, see Table
Setup). If there are multiple recipients, separate them by comma.
Security
Protocol used by the SMTP server. Possible values are: SSL or TLS.

Note Leave this setting empty if your SMTP server does not use such protocols.

HTML Settings

General

Title
Title displayed on all pages.

Note
If you use Multi-Language (see PHP Settings), use Multi-Language Property Editor, see Tools for details.

Charset
Charset setting used in the META tag of the site and for exporting data.

Note If you use Multi-Language (see PHP Settings), this setting must be utf-8.

Font
Default font (not specified if not entered)

Size
Default font size (pixel). Unit must be in pixel for working with Bootstrap (see below).

Site icon
Icon of the site. For browsers to show your URL with an icon. Must be an .ico file.

Site header logo


Logo image in the header

Note This setting is enabled in registered version only. Unregistered version allows no logo.

Site footer text


Footer text (e.g. copyright statement)

Notes

1. If you use Multi-Language (see PHP Settings), use Multi-Language Property Editor, see Tools for details.
2. This setting is enabled in registered version only.

Theme
Provides over a dozen of themes for you to setup the look and feel of your project quickly.

You can change the various properties of the selected theme to suit your style. The property name are self-explanatory.
Themes are intergrated with Bootstrap, you can customize Bootstrap properties directly in the Theme tab, scroll down to
find the Bootstrap variables which start with "@".

Notes

1. Changing a setting in the user interface does not change the corresponding setting in the theme definitions, it only
changes the setting for the project. The theme definition files (in XML format) are installed in the subfolder "themes"
under the installation folder. You can easily add your own themes by duplicating one of the theme definition file
(except the theme.xml which is for defining the settings and data type in a theme), rename it and modify the
settings in the file, just make sure you give your theme an unique theme name.
2. Bootstrap is a sleek, intuitive, and powerful front-end framework for faster and easier web development, to get
started, checkout http://getbootstrap.com/2.3.2/.
3. After changing theme properties, make sure you re-generate *.css files.

Styles

Edit styles
A separate CSS stylesheet will be generated for each project. Click the [Edit styles] button to open CSS editor.

Notes

1. All projects use CSS stylesheet.


2. If you have TopStyle Pro (v1.5+) or TopStyle Lite (v1.5-3.1) installed on your PC, PHPMaker will use it
automatically.

Notes When you edit the CSS styles in the editor, note the follows:

1. DO NOT MODIFY the system styles section, it is generated by the system, your modifications will be overwritten. If
you want to change the stylesheet template, modify the ew.css in the "themes" subfolder under the installed
directory. Only modify the ew.css if you have the necessary knowledges in CSS.
2. DO NOT REMOVE THE FOLLOWING COMMENTS:

BEGIN_USER_STYLES
END_USER_STYLES
You MUST write your styles between these two comment lines, styles outside this user styles section will
be discarded.

3. If you want to override the system styles, you can copy the styles to the User Styles Section, or you can use a
separate user stylesheet.

User Stylesheet
Specify an external user stylesheet (will be copied across during generation)
You can see the effect of new settings immediately in the preview window at the bottom of the HTML tab.
Other than choosing color from the palettes, the color picker can also pick color directly from screen using the
"eyedropper".

Security Settings

Field Description:

Administrator Login (Hard-Coded)


Administrator user id and password

Login Name
Login Name for administrator

Password
Password for adminsitrator

Use Existing Table


Link to existing table for login name and password validation
Table
Existing table in database containing login name and password information

Login Name Field


Login Name field in table used for authentication

Password Field
Password field in table used for authentication

Login Options
Login options in the login page:
Auto-login - Auto login until the user logout explicitly

When you enable the auto-login feature, a few cookies will be placed on the user's computer to identify the user, meaning
that the user do not have to type username and password every time he/she visit the site. For this reason, you should
advise your users not to use this feature on a public or shared computer, as any other user of the computer will be able to
access the account.
Remember username - Save the user's user name in cookie
Always ask - Do not save user name and password, always ask for them in the login page

Advanced Security
Advanced Security feature allows you to setup User ID, assign User Levels to users and create a complete user
registration system. To setup, click the [Advanced] button.
PHPMaker supports two types of security - User ID and User Level. User ID Security secures data at record level. User
Level Security secures data at table level. They complements each other and they can work independently or together.
Users get their User ID and User Level after login. Before login, an user's identity is unknown and the user is an
Anonymous User.

Anonymous User
The permissions for Anonymous users are defined in this form.
Steps to setup Anonymous User permissions:

1. Click on Anonymous User in the left pane,


2. Define the permissions for each table.

User ID
User ID Security secures data at record level. Protected tables must have an User ID field for identifying which user a
record belongs to. The User ID field names can be different in tables though. When User ID security is enabled, users can
only access their own data.

Steps to setup User ID security for different tables/views:

1. Click on User ID in the left pane.l


2. Select the [User ID field] from your user table, this field is usually the primary key of the User Table. (Note: if this
field is not set, the feature is disabled)

3. (Optional) Select the [Parent User ID field] from your user table. Parent User ID field stores the parent User ID
that the user belongs to, parent user can modify the child user's records. Parent User ID is hierarchical, parent
users can access the records owned by the child users of their child users. (Note: if this field is not set, the Parent
User feature is disabled.)

4. In the [User ID Field] column, select the User ID Field for the tables/views that requires User ID security.

5. (Optional) Enable [Allow View All] if you allow all logged in users (not including Anonymous User) to
list/search/view (but not add/copy/edit/delete) all records in the table.

User Level
User Level Security secures data at table level. Each user level is granted with specific permissions to tables in the
database.
There are 2 types of User Level security:
1. Static User Levels - the User Levels and the permissions are defined in this form and the User Levels are not to be
changed after script generation.

Steps to setup static User Level security for different tables/views:

1. Click on User Levels in the left pane,


2. Select an integer field in your user table as the [User Level field], (Note: if this field is not set, the feature is
disabled)
3. Define your user levels, click icon the add an user level and icon to delete an user level.

2. Dynamic User Levels - the User Levels and the permissions are defined in 2 tables in the database, the User Levels
can still be changed with the generated scripts.
Steps to setup dynamic User Level security for different tables/views:
1. Click on User Levels in the left pane,
2. Select an integer field in your user table as the [User Level field],(note: if this field is not set, the feature is
disabled)
3. Switch to the [Dynamic User Levels] tab, check [Enable Dynamic User Levels],
4. Select your User Level Table and User Level Permission Table and the required fields.
The User Level Table and User Level Permission Table must have the following fields, note the data types, User Level
ID and the Permission fields must be of integer type, the field names can be different though:

If you want PHPMaker to create these 2 tables in your database, click the [Create tables] button, the following form will
display for you to change the table/field names if necessary. You can change the table/field names and then click OK to
continue.
If you have projects created by previous versions of PHPMaker you may want to use dynamic User Levels and migrate the
previously defined static User Levels in the project to the database. After selecting or creating the User Level and User
Level Permission tables/fields, just click the [Migrate] button to let PHPMaker do that for you.
After setting the user levels, PHPMaker will populate the user levels to the User Level field's Edit Tag (also see Field
Setup) so administrators can assign user levels using the generated pages.
There are two built-in user levels:
Administrator - Administrator user level is a built-in user level that has all permissions plus the privileges to modify User
IDs and User Levels. Its permissions are same as that of the hard-coded Administrator. The User Level ID of Administrator
is -1.
Default - Default user level is built-in user level with user level = 0. Since User Level field is an integer field, if you set a
default value of 0 for this field, this user level will become the default user level for the user after registration and before the
Administrator assigning another higher user level.

Important Notes on User Levels

1. Even you enable all permissions for an user defined User Level, the User Level will NOT become same as this
Administrator User Level. User defined User Levels will not have the permissions to manage users (although
parent users has some control on their child users).
2. From v9, the permissions for List/Search/View are separate in newly created projects. However, for backward
compatibility, the permissions for List/View/Search in converted projects (created by previous versions) are the
same unless you have enabled Separate permssions for List/View/Search in Advanced Settings.
3. You may need to use the hard-coded Administrator Login to log on and assign dynamic user levels to users
initially.
4. It is possible to use single login and common Dynamic User Levels for multiple projects provided that ALL projects
use the same project name and same Advanced Security tables (i.e. User Table, User Level Table and User Level
Permission Table). If all projects uses the same database and same Advanced Security tables, then the latter
condition is automatically fulfilled. However, if the projects use different databases, you need to use
Database_Connecting server event to change the connection info so the user can get the Dynamic User Levels
from the common Advanced Security tables correctly during login. For the projects not using the database with the
common Advanced Security tables, you still need to create dummy Advanced Security tables (with same table/field
names as the common Advanced Security tables) in the project database so you can setup Advanced Security.

User Login Options


User Login Options allows you to create a complete user registration system for your Web site, with options to let user
register, change password and recover password.
Login
Track failed attempts
If enabled, number of failed login attempts (invalid password) will be tracked. If exceeded, the user will be locked out and
the password must be reset.

Maximum failed attempts


The maximum number of failed login attempts

Failed attempts windows (minutes)


The time window, in minutes, during which failed password attempts are tracked.

Disallow concurrent login


If enabled, only one session is allowed for each user (except the hard-coded Administrator). If one user has already logged
in, other users trying to login with the same username (and password) will be rejected.

Note Users are distinguished by Session ID as recognized by the web server. If you login again with your PC in another
window of the same browser or in just another tab of your browser, you can still login. If you login again with another
browser or another PC, the Session ID will be different and the login will be rejected.

Login status timeout (minutes)


The number of idle minutes after which the login status will be considered as logged out and login will be allowed again.
If a logged-in user does not explicitly log out (for example, close the browser directly), the user session is not closed and
the user's login status will remain as "logged in". Attempts to login again will fail. This timeout setting ensures login will be
allowed again after a period of idle time.
CAPTCHA (requires extension)
Optionally requires user to type letters or digits from a distorted image that appears on the screen..

Note Requires CAPTCHA extension, click Tools->Extensions from the main menu to enable. Also see Third-party Tools.

Password
MD5 password
Use MD5 password

Notes

1. If you enable MD5 password, make sure that the passwords in your user table are stored as MD5 hash (32-
character hexadecimal number) of the clear text password. If you also use case-insensitive password, convert the
clear text passwords to lower case first before calculating MD5 hash. Otherwise, existing users will not be able to
login. MD5 hash is irreversible, password will be reset during password recovery. Note that the reset password is
also in the format of 16-character hexadecimal number, it is NOT the MD5 hash of the old password.

2. PHPMaker will try to detect salted password created by other application. (PHPMaker itself does NOT create salted
password.) If salted, the password must be stored in '<hashedstring>:<salt>' format, and the hashed string must be
the md5 hash of the concatenated string of the clear text password and the salt. Other salt algorithm is not
supported, you can however customize the function ew_EncryptPassword() in the template to suit your applcation.

Case-sensitive password
Use case-sensitive password

Enable password expiry


If enabled, user password will expire after a period of time (except the hard-coded Administrator password)

Password expiry time (days)


For use with Enable password expiry, user password will expire after the specified number of days

User Registration Page


Enabled
Generate user registration page and add a link in login page.

Fields
Select fields (from the user table) to show in the registration page. Click the [...] button the select the fields.

CAPTCHA (requires extension)


Optionally requires user to type letters or digits from a distorted image that appears on the screen..

Note Requires CAPTCHA extension, click Tools->Extensions from the main menu to enable. Also see Third-party Tools.

Confirm before submit


Optionally send email confirmation after registration

Send email
Optionally send email confirmation after registration

Requires activation
Optionally requires user click an activation link in the email sent after registration to activate the user account.

Note Send email must be enabled for sending the email with activation link.

Auto login after registration/activation


Optionally auto-login the user after registration or activation.
Note Requires activation is enabled, the user is not activated yet after registration, auto login will be applied when the user
clicks the activation link in the email.

Change Password Page


Enabled
Generate change password page
Send email
Optional email confirmation after changing password
CAPTCHA (requires extension)
Optionally requires user to type letters or digits from a distorted image that appears on the screen.

Note Requires CAPTCHA extension, click Tools->Extensions from the main menu to enable. Also see Third-party Tools.

Password Recovery Page


Enabled
Generate password recovery page (forgot password page) and add a link in login page. User name and password will be
sent to the user's email address.

CAPTCHA (requires extension)


Optionally requires user to type letters or digits from a distorted image that appears on the screen.

Note Requires CAPTCHA extension, click Tools->Extensions from the main menu to enable. Also see Third-party Tools.

User Table Fields


Email address field
Email address field in user table used for sending email

Activated field
Email activated field in user table used for storing the status of user. A boolean field is recommended, although an integer
field or a string field will also work.

Notes

1. To enable user account activation, the Requires activation and Send email options under User Registration Page
must be checked. The user needs to click an activation link in the email sent after registration to activate the user
account.

2. If enabled, make sure the activated field for existing users in your user table is updated with your activation values
(e.g. True/False, 1/0, Y/N) or the existing users cannot login because they are not recognized as activated. You
can enable Multi-Update feature for the user table so administrators can activate or deactivate existing users
easily.

Profile field
A memo field for persisting all the additional user information. This field is required if the following options are used:
Track failed attempts
Disallow concurrent login
Enable password expiry

Email Template
The email sending function and the email contents can be customized in the template. The following special tags are used
in the email templates:
<!--$From--> is sender email address
<!--$To--> is user email address
<!--$Password--> is user password
<!--FieldName--> (without the $ symbol) is the field value.
For example, <!--LastName--> is the field value of the field "LastName".
The email format can be either "TEXT" or "HTML". If you use HTML, change the line "Format: TEXT" to "Format: HTML"
and enter HTML content below it.
You can also dynamically change the email by code using Email_Sending event before the email is sent. (See Server
Events and Client Scripts)

Also See:
Tutorial - User ID Security
Tutorial - Static User Level Security
Tutorial - Dynamic User Level Security
Tutorial - User Registration System

Generate Settings

Template file
Template archive (zip file)
Application root folder
The root folder of the PHP application. (See Application Root for more info on application root)

Destination folder
The destination folder where the PHP scripts are to be generated. The folder is usually same as the application root folder
or a subfolder under the application root folder.

Output filename
None - no prefix/suffix is added
Prefix - a prefix is added to all output file names
Suffix - a suffix is added to all output file names
Prefix/Infix/Suffix
The string to be concatenated to output file names when the Prefix or Infix or Suffix option is specified

Lowercase
Specify whether output file names are in lowercase

Extension
Extension name of the generated scripts, default is "php".

Default page
File name of the start page, default is "index.php".

Note This is just the file name of a website's default page usually named index.php. This is NOT the start page (see
below) of the generated site.

Generate a blank page


Specify whether to generate a blank page with header and footer for you to customize and add your own pages to the site.

Note By default the generated blank page is named as blankpage.php. You should rename the page before
customizing the page, or the page may be overwritten by a blank page in next generation if you have not disabled
this option.

Start page
Specify the first page that the default page (usually "index.php") should redirect users to.
If this setting is left blank, user will be redirected to the List page of the default table (see Table Setup) or the first table that
the user have permission to access.
If this setting is not blank, the default page will simply redirect user to the page you specify, e.g. a page not generated by
the current project. If you start the site by the typical index.php, leave this setting blank, do NOT enter index.php or there
will be a indefinite loop.

Testing web server


Specify the web server that you want to use to test the generated site. For use with Browse after generation (see below).
You can choose IIS Express or Other. Requires IIS Express installed on the same machine as PHPMaker.
IIS Express is a simpler and self-contained version of IIS that is optimized for developers. IIS Express is free, does not
require administrative privileges to run and supports all Windows platforms XP and above. It can be downloaded from
microsoft.com.
If you choose Other web server (e.g. you use IIS or Apache), you need to specify Testing root URL (see below) also.

Browse after generation


Specify whether to open a browser to test the generated site after script generation.

Testing root URL


Specify the URL of your testing site that maps to the Application root folder (see above). For use with Browse after
generation. If you use IIS Express, this setting is NOT required.
For example, if you have set up a website like:
Application root folder: C:\Documents and Settings\Administrator\My Documents\mycompany.com
Destination folder: C:\Documents and Settings\Administrator\My Documents\mycompany.com\project1
and you have setup your testing website's document root at the application root folder, so that you browse the main site by:
http://localhost/
and browse the PHPMaker generated site by:
http://localhost/project1/
Then the Testing root URL should be:
http://localhost/
(NOT http://localhost/project1/, which points to the Destination folder).
PHPMaker will calculate the relative path and add "project1/" to the Testing root URL when opening the browser.

After setting above, click the [Generate] button to generate scripts. PHPMaker allows you select scripts to generate, just
select the files you want to generate in the [Output] column. If you want include PHPMaker scripts into your custom PHP
scripts, you may not want to generate header and footer in those pages. Then you can enable [No header/footer] for
those pages. Note that header/footer means the header row containing the site header logo and the footer row containing
the site footer text.
After selection, click the [Generate] button to generate scripts.

Note If it is your first generation for the project or you have changed some project level settings, you must select [Other
files] to generate the non table-specific pages.

If you modify settings for a table and want to re-generate script for that table only, you can click [Unselect All], then select
the files you want to re-generate and click the [Generate] button to generate again. If you are not sure which files to re-
generate, click [Select All] and re-generate all files.
You can also right-click the column header of [Output] or [No header/footer] to quickly select all or unselect all items in
the column.

If you need to abort script generation in the middle of the process, just click the [Cancel] button under the progress bar
that displayed during generation.

Also See:
Customizing Template
Project File

Table Setup

Note For simplicity, we use "table" in the following description to refer to any of database object in the project. A database
object can be either a table, a view, a Custom View or a report.

After loading the database, the tables will be shown in the database pane on the left pane. To access ALL setting for a
table (including Multi-page, Table-specific Options and Master/Detail), click the table node of any table in the
database pane and then click the [Table] tab to go to the Table Setup page. This is the setup page for a single table.
You can also click on the [Tables] or [Views] or [Custom Views] or [Reports] node in the database pane to go to the
Tables Setup page which is a grid showing the most frequently used settings for all tables. If you need to set these settings
for multiple tables, this page allow you to view and set them quickly. Note that this page does not include Multi-page,
Table-specific Options and Master/Detail.

Notes
1. For all checkbox or combobox columns, if you want to apply the setting to ALL tables or views, you can choose
your setting at the [Tables] or [Views] or [Custom Views] or [Reports] row.
2. View/Edit/Search functionality works at field level and can be setup for each field in the Field Level Setup page.
Please refer to the Field Setup for details. If all fields are not selected for View/Edit/Search, the function will not be
generated.
If you prefer to view the tables in alphabetical order, click [Tools]->[Sort Tables Alphabetically] (see Tools).
You can still change the display order of the menu item by drag-and-drop. Select a table by clicking the first column -
[Table/View Name] column, then drag and drop to where you want. Note that a table cannot be moved out of its parent
node.
Note that changing the display order of table in this Table Setup page does not change the display order of the tables in
the menu. To change the display order of the menu item, click [Tools]->[Menu Editor] (see Tools).

Important

1. It is assumed that all tables have primary key. (Composite key is supported) If there is no primary key specified,
View/Add/Copy/Delete/Edit/Update settings have no effect and will be reset to disabled when the [Generate] button
is pressed. Only the List page can be generated. If you add back a primary key later, you'll need to come back to
this page and re-enable them. Since reports are read-only, View/Add/Copy/Delete/Edit/Update settings are not
applicable to reports.
2. Views or Custom Views involving more than one table are usually NOT updatable. Although you can force
PHPMaker to enable the Add/Copy/Delete/Edit/Update pages by specifying a primary key, the generated pages
will not work if these views or Custom Views cannot be updated like regular tables.
The available table level settings are as follows:

General
Generate
Select/unselect a particular table for generation

Caption
To change the caption of a table, click on [Caption] box to make the necessary change.
Note If you use Multi-Language (see PHP Settings), use Multi-Language Property Editor, see Tools for details.

Filter
Specify a filter (WHERE clause) for the table. Click the [...] button in [Filter] column, the Filter Editor will popup. Enter your
filter, you can drag the field names from the left pane to the editor, the SQL identifier quote characters will also be added
for you automatically.
Note The filter must be a valid PHP expression and it will be concatenated to the SQL. If it is a string, it should be double
quoted.

Sort
Specify the sort fields (ORDER BY clause) for the table. Click the [...] button in [Sort] column, the following dialog box will
popup. You can choose up to 6 fields, in either ascending or descending order.

Default
Set a Table as the Default Table. The Default table is the first table the user see when visiting your site. Select the table
you want in the [Default] column.

List
Inline Add
Enable/disable Inline Add function for the table. Inline Add allows users to add a record within the List page. Default is
disabled.

Inline Copy
Enable/disable Inline Copy function for the table. Inline Copy allows users to copy a record within the List page. Default is
disabled.

Inline Edit
Enable/disable Inline Edit function for the table. Inline Edit allows users to edit a record within the List page. Default is
disabled.

Grid Add
Enable/disable Grid-Add function for table. Allows users to add multiple records to the table. Default is disabled.

Grid Edit
Enable/disable Grid-Edit function for table. Grid-Edit allows users to edit multiple records within the List page. Default is
disabled.

Detail Add
Enable/disable Master/Detail-Add function for table (as detail table). Allows users to add multiple records to the detail table
in the Add page of the master table. Default is disabled.
Detail Edit
Enable/disable Master/Detail-Edit function for table (as detail table). Allows users to edit multiple records of the detail table
in the Edit page of the master table. Default is disabled.

Detail View
Enable/disable Master/Detail-View function for table (as detail table). Allows users to view multiple detail records in the
View page of the master table. Default is disabled.

Multiple Detail Tables


Enable/disable multiple Detail Add/Edit/View.
By default each pair of Master/Detail tables are handled separately, meaning that in a page, there are one master table
(the current table) and one of its detail tables only. If this option is enabled, all detail tables will be displayed together in the
same page. Enabling this option will hide separate Master/Detail table pairs.

Requires Search Criteria


Specifies if the List page requires search criteria. Default is disabled.

Notes

1. If enabled, the List page always requires search criteria. When the page is initially loaded, no records will be
displayed until searching is done. (Remember to enable Quick Search, including Extended Quick Search, or
Advanced Search or both. See below.)
2. If a record is added but the new record does not meet the search criteria (or there is no search criteria yet), the
record will not appear in the List page. So this option is best for tables which are for browsing only.

Detail Record Count


Specifies if the number of detail records for the master record should be displayed. Default is disabled.

Note

1. Applicable to master tables with master/detail relationships defined in PHPMaker only, see below.
2. If the detail table is a report, this feature is NOT applicable, there will be NO detail record counts for the detail
report.
3. The counts are retrieved by using a subquery for each detail table. The more detail tables, the more performance
penalty. You should enable this feature discreetly.

Sequence number
Add a column to show the sequence number (record index) of the record in the recordset.

View
View
If enabled, a View page for the table will be generated (for displaying a record). Default is enabled.

Note The table must have primary key or this setting will be unchecked during generation.

Add
Add
If enabled, an Add page for the table will be generated (for adding/copying a record). Default is enabled.
Note The table must have primary key or this setting will be unchecked during generation.

Copy
If enabled, Add page will be generated and "Copy" links will be generated for record(s) in List/View page (for copying).
Default is enabled. (If this setting is enabled, the "Add" setting is also enabled by default as copying requires the Add
page.)

Note The table must have primary key or this setting will be unchecked during generation.

CAPTCHA
Enable/disable CAPTCHA function for the Add page. Default is disabled. (CAPTCHA requires that the user type the letters
or digits of a distorted image before submitting a form to prevent automated software from posting spam to your web
application.)

Notes

1. Requires CAPTCHA extension, click Tools->Extensions from the main menu to enable. Also see Third-party
Tools.
2. Not applicable to Inline/Grid-Add/Copy.

Confirm
Enable/disable confirmation function for the Add page. Default is disabled. If enabled, there will be a confirmation step in
the Add page, users will be able check their input before actually inserting the record.

Note Not applicable to Inline/Grid-Add/Copy.

Edit
Edit
If enabled, an Edit page for the table will be generated (for updating a record). Default is enabled.

Note The table must have primary key or this setting will be unchecked during generation.

CAPTCHA
Enable/disable CAPTCHA function for the Edit page. Default is disabled. (CAPTCHA requires that the user type the letters
or digits of a distorted image before submitting a form to prevent automated software from posting spam to your web
application.)

Notes

1. Requires CAPTCHA extension, click Tools->Extensions from the main menu to enable. Also see Third-party
Tools.
2. Not applicable to Inline/Grid-Edit.

Confirm
Enable/disable confirmation function for the Edit page. Default is disabled. If enabled, there will be a confirmation step in
the Edit page, users will be able check their input before actually updating the record.

Note Not applicable to Inline/Grid-Edit.

Check Conflicts
Check if the record is changed by other user before updating the record.

Notes

1. Since processing of current data for later comparison is required, using this feature will increase the time required
to load the page. For better performance only the first hundreds of bytes of the BLOB fields are processed by
default, but there are chances that change of BLOB data is not detected (if the first nth bytes are not changed).
You can increase the number of bytes in Advanced Setting, if you want to process all bytes, enter 0.
2. You can use the Row_UpdateConflict server event (see Server Events and Client Scripts) to resolve the conflicts
according to your business logic by code.
3. Not applicable to Inline/Grid-Edit.

Delete
Delete
If enabled, a Delete page for the table will be generated (for deleting record or multiple records). Default is enabled.

Note The table must have primary key or this setting will be unchecked during generation.
Multi-Update
Multi-Update
If enabled, a Multi-Update page for the table will be generated (for updating multiple records). Default is disabled. With this
feature you can select multiple records in the List page and update all records at the same time. You can select fields (see
Field Setup page) to be included in the Multi-Update page.

Note The table must have primary key or this setting will be unchecked during generation.

Confirm
Enable/disable confirmation function for the Multi-Update page. Default is disabled. If enabled, there will be a confirmation
step in the Multi-Update page, users will be able check their input before actually updating the selected records.

Search
Quick
If enabled, Quick Search panel (including Extended Quick Search) will be generated with the List page. Default is enabled.
Quick Search searches text fields and optionally numeric fields only. These fields are selectable in Field Setup page. You
may want to hide the Quick Search form for tables that do not have searchable fields.

Default value
Default value for Quick Search.
If no user input for Quick Search, this default value will be used. After users entering their search criteria, the default value
will not be used.

Default search type


Default search type for Quick Search. Possible values are:
Any words
All words
Exact match

Extended
If enabled, Extended Quick Search inputs will be generated in the List page. Default is disabled.

Fields per Row


For use with Extended Quick Search. Specifies the number of fields per row in the Quick Search panel. Default is 0
(unspecifed), which means one field per row.

Advanced
If enabled, an Advanced Search Page will be generated and linked to the List page. Default is disabled.

Highlight
If this setting is checked, the search criteria in the search result (List page) will be highlighted. Default is disabled.

Audit Trail
To use this feature, you must also specify the [Audit Trail folder] or database table and field under [PHP]->[General
Options] tab. See PHP Settings for details.

Audit Trail
If audit trail for a table is enabled, when an user add/copy/edit/delete a record or login/logout, the related information will be
logged in a log file. To use this feature, you must also specify the [Audit Trail folder] under [PHP]->[General Options]
tab. See PHP Settings for details.

Email Notification
To use this feature, you must also specify the [Email Settings] under [PHP]->[Email Settings] tab. See PHP Setup for
details.

On Add
If enabled, when an user add a record, an email will be send to pre-set recipient email address(es). Default is disabled.
On Edit
If enabled, when an user edit a record, an email will be send to pre-set recipient email address(es). Default is disabled.

On Delete
If enabled, when an user delete a record, an email will be send to pre-set recipient email address(es). Default is disabled.
Other than above Tables Setup page, you can also click on a particular table node (under [Tables] or [Views] or [Custom
Views] or [Reports] node) in the database pane to go to the Table Setup page for that table. The Table Setup page
includes the following tabs: Table, Fields, and Server Events/Client Scripts. Click on the Table tab you'll see settings for
the selected table only. The right side includes two panel - the [Table-specific Options] panel and the [Master/Detail]
panel (see below), the left side contains settings same as above (but for the selected table only) plus the following
additional settings:

Multi-page
Normally each field is displayed as a table row in the View/Add/Edit page, this Multi-Page features allow you to display
divide the fields into pages and display only one page at a time. To enable, at least one field with page number larger than
1 must be set up in Field Setup page. This feature is presented as tabs.

Multi-Page type
Specifies how to display the pages. Possible values are:

Tabs - use Bootstrap basic tabs (default)


Pills - use Bootstrap basic pills
Accordion - use Bootstrap Collapse

Page Labels
Specifies the page captions of each page in the Multi-Page. Click the [...] button and enter the page captions and click
[OK] to save.
If page captions are not specified, "Page n" will be used by default. To add a page, go to Field Setup page, specify the
page number for the fields in the page first.
Note If you use Multi-Language (see PHP Settings), use Multi-Language Property Editor, see Tools for details.

Add page
Specifies if Multi-Page is enabled for Add page.

Edit page
Specifies if Multi-Page is enabled for Edit page.

View page
Specifies if Multi-Page is enabled for View page.

Register page
Specifies if Multi-Page is enabled for register page. This setting is only available for the user table specified in Security
Settings.

Return Pages
After Add
Specifies the return URL after a new record is added.
Note The URL must be a valid PHP expression. If it is a string, it should be double quoted.
Example 1
If you want to redirect user to a custom page, enter: (with quotes)
"MyPage.php"
Example 2
If you want to pass field values, enter: (with quotes)
"MyPage.php?xxx=" . urlencode($this-><Field>->CurrentValue)
e.g.
"MyPage.php?ID=" . urlencode($this->ID->CurrentValue)
Example 3
If you have just added a master record and want to go to Grid-Add page of the detail table, enter: (with quotes)
"<DetailTable>list.php?a=gridadd&showmaster=<Table>&<KeyField>=" . urlencode($this-><Field>->CurrentValue)
e.g.
"OrderDetailslist.php?a=gridadd&showmaster=Orders&OrderID=" . urlencode($this->OrderID->CurrentValue)
Example 4
If you have just added a master record and want to go to Add page of the detail table, enter: (with quotes)
"<DetailTable>add.php?showmaster=<Table>&<KeyField>=" . urlencode($this-><Field>->CurrentValue)
e.g.
"OrderDetailsadd.php?showmaster=Orders&OrderID=" . urlencode($this->OrderID->CurrentValue)
After Edit
Specifies the return URL after a record is edited.

Note The URL must be a valid PHP expression. If it is a string, it should be double quoted.

After Register
Specifies the return URL after an user is registered. This setting is only available for the user table specified in Security
Settings.
Note The URL must be a valid PHP expression. If it is a string, it should be double quoted.

Table-specific Options
These options are same as the list page options as described in PHP Settings except that the options are table-specific,
meaning that you can have different list page options for different tables. To use table-specific options, select a table in the
grid, uncheck [Use global settings] in the [Table-specific Options] panel, the panel will be enabled for you to setup.

Master/Detail
When you set up a master/detail relationship, you link two tables so that all the records of one table (the detail table)
always correspond to the single current record in the other table (the master table). Each table can have multiple master
tables and details tables.
You can establish master/detail (one-to-many) relationship between two tables as follows
1. Select a table in the table grid,
2. Then in [Master/Detail] panel at the bottom right corner of the page, click [Modify...] to bring up the visual
master/detail relationship editor.
3. Click [Add table] to add the master and detail table to the diagram.
4. Create a relationship between them by dragging from the master field (key field in master table) to the detail
field (foreign key field in the detail table). If there are more linked field, repeat the step until all the relationships
are setup.

If you want to remove a relationship, select the link in the diagram and click [Delete]. After setup, click [OK] to confirm.

Note The diagram only shows master/detail relationships of the selected table. Although you can setup relationships for
other tables in the diagram and view them in the [Master/Detail] panel immediately after clicking [OK], the relationships for
other tables will not be loaded again if you go to other table and then come back to this table. Instead, the relationships will
only be displayed when you change to the related tables.

In most cases, master and detail tables are joined by one field, you have one link between the master/detail table and you
have one row in the Master/Detail panel only.

Referential Integrity
Specifies that user may not add/update a record in the detail table unless the foreign key points to a valid record in the
master table.

Cascade Delete
Specifies that if a record in the master table is deleted, all corresponding records in the detail table will be deleted.

Note If you have used ON DELETE CASCADE for the table in the database, no need to enable this setting.
Cascade Update
Specifies that if the primary key for a record in the master table changes, all corresponding records in the detail table will
be updated.

Note If you have used ON UPDATE CASCADE for the table in the database, no need to enable this setting.

Also See:
Tutorial - Master/Detail

Field Setup

After loading the database, the database objects (tables, views, custom views and reports) will be shown in the left pane
(the database pane). Click on any table to go to the Field Setup Page for that table at any time.

Note For simplicity, we use "table" in the following description to refer to any of database object in the project. A database
object can be either a table, a view, a Custom View or a report.

PHPMaker support most commonly used data types. If PHPMaker finds any unsupported fields in a table, an
[Unsupported Fields] tab will appear. You can click on the tab to view the list of fields that are not supported.
The Field Setup pages consists of two section. The upper section is a grid showing available options of all fields. The lower
section contain two panels, the [Edit tag] panel and the [View tag] panel for the selected field.

The grid consists of the following sections:


General
List Page
View Page
Edit Page
Add Page
Multi-Update Page
Advanced Search Page

General

Properties
Field Name
Field Name (read only)

Data Type
Data Type (read only)

Size
Maximum field length (read only)

Caption
Field caption to be displayed

Primary Key
Primary Key of the table. Composite key is supported.

Important

1. You should use the same primary key as declared in the database, do not change it unless you are absolutely sure
that the selected field(s) values are unique. Otherwise a record cannot be located properly and unexpected results
may occur.
2. Primary key is uneditable in the edit page.

Page No.
Page number of the field. For use with Multi-Page. By default all the fields are in page 1 and Multi-Page is disabled.
Multi-Page is supported for Add/Edit/View/Search pages, you can optionally enable it for each page. Page labels are also
supported. See Table Setup.
If Multi-Page is enabled and the page number is 0, the field will appear in all pages.

Note You can multi-select the fields by ctrl-click or shift-click the Field Name column and then right click to set the page
number for the selected fields simultaneously.

Auto-Update Value
A dynamic value to update the field function automatically in Add/Edit pages.
The dropdown list for this setting is preloaded with a few functions for your selection. For example, you may want to record
the last modified date of a record, then you can select "ew_CurrentDate". Do not select a function that return values of
unmatching data type, for example, you should not select a function that return a non-numeric string for a numeric field.

Notes

1. This setting will make the field hidden automatically and it overrides the default value in Add page and custom
value for Hidden Edit tag in Edit page. (see section below)
2. You can add your own PHP functions, the function must accept no argument and return a value. You can add your
function names (comma separated) for the Advanced Settings Auto-Update values (See Tools - Advanced
Settings), e.g. You can enter: (no quotes)
3. MyAutoValueFunction1,MyAutoValueFunction2
4. Then put your functions under server side Global Code section, see Server Events and Client Scripts.
Custom field display order by drag-and-drop
You can change the field order defined in the database by simple drag-and-drop. Simply ctrl-click or shift-click the Field
Name column to select the field, then drag it to where you want. PHPMaker will generate scripts and display records
according to this order.

List Page

Properties
List
Show field in list page

Note The setting is also used for Inline/Grid-Add/Edit and Master/Detail-Add/Edit/View.

Export
Include the field when export
Aggregate
Enable Field Aggregation. Aggregated values will be shown at Page Footer. Not applicable in multi-column view.
Aggregate options include:
- TOTAL (sum of all field values in current page)
- COUNT (count of records in current page)
- AVERAGE (average field value in current page)

Width
Specify CSS width property for field column width . e.g. If you enter: (no quotes)
200px
the output will be:
style="width: 200px"
Note If your table is too wide, browsers will try to best fit the content into screen and the specified width may be overridden.

Wrap
Enable/Disable text-wrap for field value

Note If you enable text-wrap but the field value has no line-breaking points (e.g. spaces or punctuation), the text still
cannot be wrapped.

Quick Search
Include this field when performing Quick(Basic) Search in the List page.
Note Only text fields and numeric fields are supported in Quick Search. By default only text fields are enabled.
Ext. Search
Use this field in Extended Quick Search
Extended Quick Search is enhancement of Quick Search. If a field is checked for Ext. Search, a form element for the field
will be shown in the Quick(Basic) Search form and the user input criteria for this field will be included when performing
Quick(Basic) Search.
Extended Quick Search will use the same search operators specified under the "Advanced Search Page" section (see
below).

View Page

Properties
View
Show field in view page

View Tag
HTML tag to display the field. Used in List/View pages.

You can either click the [View Tag] column and select a View Tag from the drop down box or click the icon on the View
Tag panel toolbar to select. After selecting the View Tag, you can further setup its properties in the View tag panel.

View Tag
There are two types of View Tag, Formatted Text and Image.
Formatted Text - View Tag to display the field value as formatted text using <div> tag with optional hyperlink. Properties:
DIV Tag attributes
Style
Align - Left/Center/Right/Justify. Align the data.

Italic - Display as Italic

Bold - Display as Bold

Custom Attributes
Other custom attributes for the <div> tag. For example, you can enter: (with double quotes)
"onmouseover='my_js_function();'"

Notes

1. The setting must be a valid PHP expression. If it is string, it should be double quoted.
2. If you use your own JavaScript functions for the client events. You can put your JavaScript functions in the Global
Code for client scripts (see Server Events and Client Scripts) so it is available for use in the generated scripts.
3. Sometimes the generated code already uses some attributes (e.g. onXXX events), if you add the same attribute
here, it may be ignored by some browsers. In such cases, use the Row_Rendered server events instead (see
Server Events and Client Scripts).

Format
None
No formatting
Currency
Display as formatted currency
Date/Time
Display as formatted date

Note For simplicity the Date/Time named format indicates the date format with "/" as the date separator regardless of the
Default date format setting, but the actual date separator used in the generated scripts is determined by the Default date
format setting (see PHP Settings).

Number
Display as formatted number

Percent
Display as formatted percentage

String
Format the field value with specified PHP string function or custom function
Replace CR+LF by <BR>
Display the fields with CR+LF replaced by <BR> (available for memo fields only)
Max Length (List page)
Truncate the field value at specified max. length and append "..." to the end.

Note This setting only applied to memo fields in list page and must be larger than 0 to take effect.

Hyperlink
HREF field
Display the field as hyperlink with the href attribute set to the value of this field. It can be the field itself.

Original field value


Use original field value of the Href field in the hyperlink instead of display field value.
If the HREF field has lookup table or user values, by default the display value will be used. If this option is enabled, the
original field value will be used instead.

Target
Target attribute of the hyperlink. Possible values are: _top, _parent, _self, or _blank. You can also enter your own.
Prefix
Prefix added before the HREF field value. You can select one of the follows:
- None (no prefix, relative path of URL)
- http:// (prefix http:// added, absolute path of URL)
- mailto: (prefix mailto: added, email link)
- ftp:// (prefix ftp:// added, ftp link)
- file:// (prefix file:// added, file link)
- news:// (prefix news:// added, newsgroup link)
You can also enter your own partial URL (preceding the HREF field value)

Note This setting is a string to be quoted by double quotes, if you want to use PHP variable, wrap it in "{" and "}". Since "{"
can not be escaped, this syntax will only be recognized when the "$" immediately follows the "{". Read PHP Strings for
more information on parsing variable in string.

For example, you can enter: (no quotes)


mypage.php?id=
The value of the HREF field will be appended to the end of the your prefix in the outputted HTML.
If you want pass a field value, you can enter: (no quotes)
mypage.php?myfield={$this->UrlEncode($this->MyField->CurrentValue)}&id=
If you need to pass parameters which should not be URL-encoded, for example, if you use ew_Encrypt() to encrypt your
parameter, you can enter: (no quotes)
mypage.php?myfield={$this->Raw(ew_Encrypt($this->MyField->CurrentValue))}&id=

Suffix
Suffix added after the HREF field value. You can use this setting to append additional URL parameters.
For example, you can enter: (no quotes)
&field2={$this->UrlEncode($this->Field2->CurrentValue)}
Since this is a suffix, you should always use "&" at the beginning of the string.
Custom Attributes
Custom attributes for the <A> tag.
For example, you can enter: (with double quotes)
"rel='xxx'"

Notes

1. The setting must be a valid PHP expression. If it is string, it should be double quoted.
2. If you use your own JavaScript functions for the client events. You can put your JavaScript functions in the Global
Code for client scripts (see Server Events and Client Scripts) so it is available for use in the generated scripts.

Tooltip
Tooltip field
Display the field as tooltip

Tooltip width
The width of the tooltip in pixels. Default is 0 (auto).
By default the width is not specified and the width will depend on the field value. However, when the tooltip field is a long
text field, the width can take up the browser width, which may be unwanted. Then you can specify a value to limit the width.
Custom View Tag

Custom View Tag


Display the field value in List/View page by custom code.

Important Custom View Tag overrides ALL above View Tag settings.

There are some ready-to-use Custom View Tag for you to choose:

Flash Files
Google Maps
Barcode
QR code
YouTube videos

If your data stores information for above, just click the down arrow button to open the setup form, enable one of them, read
the notes at the bottpm panel carefully, then click the Settings tab to setup, and click OK to save your settings.

Notes

1. Only one of above Custom View Tag can be selected at a time. All records will use the same Custom View Tag.
For instance, you can NOT use Barcode for a record and use QR code for next record.
2. The above Custom View Tags are provided as examples only. The third party tools used are not developed by the
author of PHPMaker and are not part of PHPMaker, NO TECHNICAL SUPPORT WILL BE PROVIDED.
You can also create your Custom View Tag, they are implemented in exactly the same way as template ex ten si ion (see
Customizing Template). Custom View Tags must be placed under the subfolder "customviewtags" of the installation folder.
Each Custom View Tag must have a XML description file so it can be loaded for selection. You can open an XML file in the
"customviewtags" subfolder to see the content, which is self-explanatory. Unzip the zip file to see how it is implemented.
If you want absolute freedom, click the [...] button to enter your own code to display the your data in your own PHP, HTML
and JavaScript.

Important If you choose to enter your own code, you are completely on your own to display the field value. Intermediate
knowledge in PHP, HTML and JavaScript is required.

Custom View Tag is HTML, if you want to embed PHP code, use <?php and ?>, if you want to use JavaScript, use <script
type="text/javascript"> and </script>.
Note DO NOT use $this in your PHP code. There is no $this in the context, you can use CurrentPage() to get the current
page object.
To reuse the original code, you can generate scripts without Custom View Tag first, then customize the field in View page
as needed. When done, copy and paste your customized code to PHPMaker user interface as your Custom View Tag.
The original code will also be generated in a hidden DIV with id="orig_<table>_<field>", you can also reuse it by
JavaScript.
Example 1
Output the field value conditionally:
<?php
if (CurrentPage()->MyField->CurrentValue == "xxx") { // Assume string field
echo "something";
} else {
echo "something else";
}
?>
Example 2
Output a custom link:
<a href="mypage.php?id=<?php echo urlencode(CurrentPage()->MyField->CurrentValue) ?>">My Link</a>
Example 3
Reuse the original code by JavaScript. Replace some code in the original code by regular expression:
<div id="my_unique_id"></div>
<script type="text/javascript">
$("#my_unique_id").html($("#orig_MyTable_MyField").html().replace("xxx", "yyy").concat("zzz")); // Replace part of the old
code by new code, and append something at the end
</script>

Notes

1. Always use a DIV with unique ID to output your code. DO NOT use document.write().
2. After outputting the code as innerHTML of the output DIV. You can also further manipulate the content of the DIV
by JavaScript. Alternatively, you can manipulate the content of the hidden DIV containing the original code by
JavaScript and then copy the innerHTML to the output DIV.

Image - View Tag to display as Image using <img> tag. The field should be a BLOB field or a field storing the path of an
image.

Note Only image files can use the Image View Tag. Other files such as PDF cannot be displayed as image. If the field
contains mixed file types, do not use Image View Tag.

IMG Tag attributes


Width
Specify the width of the image in pixels
Height
Specify the height of the image in pixels
Alt
Specify the alt attribute of the image tag

Note If you use Multi-Language (see PHP Settings), use Multi-Language Property Editor, see Tools for details.

Custom attributes
Other custom attributes for the <div> tag. For example, you can enter: (with quotes)
"onmouseover='my_js_function();'"
Notes

1. The setting must be a valid PHP expression. If it is string, it should be double quoted.
2. If you use your own JavaScript functions for the client events. You can put your JavaScript functions in the Global
Code for client scripts (see Server Events and Client Scripts) so it is available for use in the generated scripts.
3. Sometimes the generated code already uses some attributes (e.g. onchange), if you add the same attribute here, it
may be ignored by some browsers. In such cases, use the Row_Rendered server events instead (see Server
Events and Client Scripts).

Resize image
Resize the image to above width and/or height on displaying the image.

Note This feature requires Image Resize extension and supports GIF, JPEG and PNG images only, click Tools-
>Extensions from the main menu to enable. The extension requires GD2 library, update your PHP version to the latest
version and enable the GD2 library if necessary. See Third-Party Tools.

Hyperlink, Tooltip and Custom View Tag (same as above)

Edit Page

Properties
Edit
Show field in edit page

Note The setting is for Edit page only, NOT for Inline/Grid-Add/Edit and Master/Detail-Add Edit in the List page. See the
List setting above.

Title
Title to be placed in title attribute of Edit Tag. (see section below) The title will also appear as popup tooltip of the Edit Tag.

Note If you use Multi-Language (see PHP Settings), use Multi-Language Property Editor, see Tools for details.

Read Only
Make the field read only in edit page

Note This setting replaces the Edit Tag by a INPUT type=hidden tag and show the field by its View Tag (see above). If you
want to set the Edit Tag's readonly attribute (supported by INPUT type=text, INPUT type=password, TEXTAREA), use
Row_Rendered server event. If you want to set the Edit Tag's disabled attribute, you can set $this-><field>->Disabled
property. (See Server Events and Client Script.)

Edit Tag
Form element for the field. Use in Add/Copy/Edit/Search pages. (See below for details)

You can either click the [Edit Tag] column and select a Edit Tag from the drop down box or click the icon on the [Edit Tag]
panel toolbar to select. After selecting the Edit Tag, you can further setup its properties in the Edit Tag panel:

Edit Tags
Edit Tags are HTML forms elements for the field in Add/Copy/Edit/Search pages. All HTML form elements are supported:
Text
<input type="text"> tag
Display the field as a textbox.

Size - size of the textbox


MaxLength - maximum input length of the textbox
Custom attributes - Other custom attributes for the tag. For example, you can enter: (with quotes)
"onmouseover='my_js_function();'"

Note The setting must be a valid PHP expression. If it is string, it should be quoted. If you use your own JavaScript
functions for the client events. You can put your JavaScript functions in the Global Code for client scripts (see Server
Events and Client Scripts) so it is available for use in the generated scripts.

Validation - see section below


Use Lookup Table - for use with Auto-Suggest and/or Auto-Fill (see below) by Ajax.

Info Auto-Suggest is Text Edit Tag with a lookup table. When the user types in the textbox, a dynamic dropdown list
populated with data from the lookup table matching the user input will appear for user to select. If the data already exists,
the user can easily select without typing the full text. If not, the user can still input as usual. Check [Use Lookup Table] to
enable this feature and then enter the lookup table info in the [Lookup Table] panel next to the [Edit Tag] panel. (See
section below)

Force selection - for use with Auto-Suggest and/or Auto-Fill (see below). This setting must be enabled if you want to
use Auto-Fill with Auto-Suggest. When this setting is enabled, the user must select one of the auto-suggested options,
the textbox will become similar to a combobox ("select-one"). This setting is usually enabled if the field stores Link field
(see below) values (e.g. primary key) of the lookup table.

Password
<input type="password"> tag
Display the field as a masked textbox.

Size - size of the textbox


MaxLength - maximum input length of the textbox
Custom attributes - same as above (see Text Edit Tag)
Validation - see section below

Radio
<input type="radio"> tag
Display the field as a radio button list.

Custom attributes - same as above (see Text Edit Tag)

Use lookup table - use an existing lookup table instead of user input value/label pairs for the radio buttons. To enable this
feature, check this option and enter the lookup table info in the [Lookup Table] panel next to the [Edit Tag] panel. (See
section below). If you don't use lookup table, you can enter the options manually in the [User Value] panel next to the
[Edit Tag] panel.
Use Ajax - specifies if Ajax is used to update the selection list.
Repeat columns - specifies the no. of radio buttons per row
Validation - see section below

Checkbox
<input type="checkbox"> tag
Display the field as a checkbox list.

Note For MySQL, PHPMaker considers enum('Y','N') and enum('1','0') as boolean fields. For Oracle, fields with two and
only two User Values (see below) and the labels and values are "Y" and "N" (or "1" and "0") will be considered as boolean
fields. PHPMaker will display a boolean field by a checkbox automatically.

Custom attributes - same as above (see Text Edit Tag)

Use lookup table - use an existing lookup table instead of user input value/label pairs for the checkboxes. To enable this
feature, check this option and enter the lookup table info in the [Lookup Table] panel next to the [Edit Tag] panel. (See
section below). If you don't use lookup table, you can enter the options manually in the [User Value] panel next to the
[Edit Tag] panel.
Use Ajax - specifies if Ajax is used to update the selection list.
Repeat columns - specifies the no. of checkboxes per row
Validation - see section below

Note The submitted values of the multi-selected checkboxes is a comma-separated string. Therefore you must use a string
field for checkbox list.

Select
<select> tag
Display the field as a combobox ("select-one") or a listbox ("select-multiple").

Size - no. of options to show. If more that 1, the selection list is shown as a listbox, otherwise it is shown as a combobox.
Multiple - Check to enable multiple selection (listbox)

Note The submitted values of the multi-selected listbox is a comma-separated string. Therefore you must use a string field
for listbox.

Custom attributes - same as above (see Text Edit Tag)


Use lookup table - use an existing lookup table instead of user input value/label pairs for the checkboxes. To enable this
feature, check this option and enter the lookup table info in the [Lookup Table] panel next to the [Edit Tag] panel. (See
section below). If you don't use lookup table, you can enter the options manually in the [User Value] panel next to the
[Edit Tag] panel.
Use Ajax - specifies if Ajax is used to update the selection list.
Validation - see section below

TextArea
<textarea> tag
Display the field as a textarea.

Cols - no. of columns of the textarea


Rows - no. of rows of the textarea
Custom attributes - same as above (see Text Edit Tag)
Use DHTML Editor - replace the textarea with a DHTML editor for editing the data as HTML. See Third-party Tools for
more info on DHTML Editors.
Validation - see section below
File
<input type="file"> tag
Display the field as a file upload control. For BLOB fields or string fields only.

Size - size of the input tag (NOT file size)


Custom attributes - same as above (see Text Edit Tag)
If the field is of BLOB (binary) data type, file is uploaded to the database.
You can also store the information of the uploaded file in the following fields: (for BLOB field only)
File type field - Recommended. Useful when you want to response to user browser the exact content type of the data.
File name field - Optional. Useful if you want to use the original filename.

Note Do not specify file name field if you want IE to open the file automatically. (IE may fail to open non-image files
retrieved from database properly.) Use file name field if you want IE to popup a File Download dialog for user to save the
file with the filename specified in the file name field.

File size field - Optional. Stores the uploaded file size.


Image width field - Optional. For use with images only. Stores the width of the uploaded image.
Image height field - Optional. For use with images only. Stores the height of the uploaded image.
If the field of string type, file is uploaded to a subfolder relative to the application root.
Multiple - Allow multiple upload. Field value will be comma separated file names. NOT application to BLOB field.
Upload folder - Folder where the uploaded file will reside. If you do not enter a specific folder, all the uploaded files will be
put in the global upload folder specified in the PHP tab (see PHP Settings).

Notes

1. Unlike the global upload folder setting (which is a constant and must be a string without double quotes, see PHP
Settings), this field setting must be a valid PHP expression. If it is a string, it must be single or double quoted.
2. Make sure that the Web server user have read/write access to the folder.
3. The path is relative to application root. Use slashes "/" as path delimiter, no leading slash. e.g. If the
application root of your website is C:\Inetpub\wwwroot\demo and you enter "uploads/folder1/" (with double quotes)
in this textbox, the folder for the uploaded files will be C:\Inetpub\wwwroot\demo\uploads\folder1. If you are not
sure which folder is application root, please read Creating Virtual Directories in IIS.
4. The path can be dynamic. For example, if the upload path varies with some field value, you can refer to other fields
by $this->MyField->DbValue. However, you must be very careful when using dynamic folder, make sure the setting
is valid as a folder name, i.e. it does not contain some characters which can not be used in a file path on your
server. The setting will be evaluated to obtain the upload folder before the file is displayed and before the uploaded
file is saved, so your setting should be consistent, do not use random number or current date/time to name the
folder. Alternatively, you can also use Row_Rendered, Row_Inserting and Row_Updating server events to set
the field object's UploadPath property.
5. If Multiple is enabled, all upload files use the same upload folder.
Resize image - Optionally resize the image to resize width and/or height.
Resize width - Width of the resized image
Resize height - Height of the resized image

Note Note that resizing requires Image Resize extension (for registered users only) and supports GIF, JPEG and PNG
images only, click Tools->Extensions from the main menu to enable. The extension requires PHP GD2 extension with
GD2, make sure it is installed. See Third-Party Tools.

Validation - see section below

Hidden
<input type="hidden"> tag
Hide the field with a hidden form element.

Note This is different from de-selecting the field in the [Edit] column. If a field is de-selected, no code will be generated for
the field in the Edit page and the field will not be updated. With a hidden form element the field is not seen but it may still
get updated.

Custom value - by default the 'value' attribute contains the field value, custom value is used to update the field with
another value when a record is updated using the Edit page.

Notes

1. Custom value is used in Edit page only. It cannot be used with Read-only fields, User ID fields and Detail
fields(Foreign key fields)
2. In Add page, if a default value is specified (see section below), hidden form element will also be used but the
'value' attribute will contain the default value. If default value is not specified, the field will be displayed as a normal
textbox.
3. Other preferable ways of updating a hidden field is to use Auto-Update Value (see above) or to use
Row_Inserting and/or Row_Updating server events.
Custom attributes - same as above (see Text Edit Tag)

Using User Values for Edit Tag (Radio/Checkbox/Select)


For Radio/Checkbox/Select Edit Tags, the default option values are user input values, you can enter as many value/label
pairs as you want in the [User Values] panel next to the [Edit Tag] panel.

Note For boolean fields, if you use Radio Edit Tag with User Values, the first value/label should be for True and the
second for False.
Using Lookup Table for Edit Tag (Text/Radio/Checkbox/Select)
In real world applications, the option values usually come from a (lookup) table in the database. PHPMaker make it very
simple to use lookup values for key field values, simple click [Use Table], the [Lookup Table] panel will replace the [User
Values] panel, select the following properties:

Table name
Required. The lookup table to be linked to.

Link field
Required. The field to be used as the value of an option. The actual value to be saved. This field is usually the key field of
the lookup table.

Display field #1
Required. The field in lookup table to be used as the label of an option.

Display field #2
Optional. The 2nd field in lookup table to be included in the label.

Display field #3
Optional. The 3rd field in lookup table to be included in the label.

Display field #4
Optional. The 4th field in lookup table to be included in the label.

Order By
Optional. Specify a field in the lookup table for sorting the options.

Asc/Desc
Optional. Sorting order. For use with Order By.

Distinct
Optional. Specify adding DISTINCT option to the SELECT statement for the lookup table.
Filter
Optional. Specify the WHERE clause of the SELECT statement for the lookup table. The input should be a valid PHP
expression. If it is a string, it should be quoted.
For example, if your lookup table has a special field for filtering the records (in the lookup table) by a field value in the
current record (of the current table), you can enter: (with quotes)
(strval(CurrentPage()->AField->CurrentValue) <> "") ? "`ALookupTableField` = " . CurrentPage()->AField->CurrentValue :
""

Notes:
1. Make sure your expression returns a valid string. If some variables in the expression has empty values, the
expression will return an incomplete WHERE clause leading to no records returned from the lookup table. So you
should always check if the variables has non empty values first. If empty, return an empty string (i.e. no filter) as in
above example.
2. If the field in the WHERE clause is of string type, remember to single-quote it. For example, if ALookupTableField
in above example is of VARCHAR type, you need to quote the value by single quotes, e.g.
a) if the value is fixed,
"`ALookupTableField` = 'SomeValue'"
b) if the value needs to be escaped,
(strval(CurrentPage()->AField->CurrentValue) <> "") ? "`ALookupTableField` = " . ew_QuotedValue(CurrentPage()-
>AField->CurrentValue, EW_DATATYPE_STRING) : ""
3. This setting is used in all pages. If you want to used in some pages only, you should add your conditions, e.g. if you
just want to use your filter in the Edit page,
(CurrentPageID() == "edit") ? "`ALookupTableField` = 'SomeValue'" : ""
4. This setting is an one liner. If your logic is complex and cannot be implemented in one line, you can write a function
and enter a function call, e.g.
MyLookupFilterFunction()
You can also pass some variables to your function as arguments, e.g.
MyLookupFilterFunction(CurrentPage()->AField->CurrentValue)
Your function should return a valid WHERE clause, e.g.
function MyLookupFilterFunction($value) {
if (strval($value) <> "") {
return "`ALookupTableField` = " . $value; // assume ALookupTableField is integer field
} else {
return "";
}
}
You can place your function in Global Code section under Server Events/Client Scripts. (See Server Events and
Client Scripts.)

Parent field #1
Optional. For use with dynamic selection lists. Specify the parent field (in the current table) for the current selection list.
When the parent selection list is changed, the available options in current selection list will be changed accordingly. Each
field can have up to 4 parent fields.

Note Parent field is solely used with Filter field for dynamic selection lists only. Each Parent field MUST have a
corresponding Filter field. The Parent field alone does NOT do any filtering.

Filter field #1
Optional. For use with dynamic selection lists. Specify the filter field (in the lookup table) for filtering.
When the parent selection list changes, only options (records from the lookup table) with Filter field value matching the
selected value(s) of its corresponding Parent field will be shown.
Note Filter field is solely used with Parent field for dynamic selection lists only. Each Filter field MUST have a
corresponding Parent field. The Filter field alone does NOT do any filtering.

Parent/Filter #2
Optional. For use with dynamic selection lists. The 2nd pair of parent field and filter field.
If setup, the filtering of lookup table records will be based on 2 fields.
For example, if you have set up Parent/Filter field #1 and Parent/Filter field #2, and both Parent field #1 and Parent
field #2 have selected value, the records will be filtered by:
(Filter field #1 value = Parent field #1 selected value) AND (Filter field #2 value = Parent field #2 selected value)

Note By default, if either parent field is not selected, above filter will lead to no results, the field will not have any options.

Parent/Filter #3
Optional. For use with dynamic selection lists. The 3rd pair of parent field and filter field. If setup, the filtering of lookup
table records will be based on 3 fields.

Parent/Filter #4
Optional. For use with dynamic selection lists. The 4th pair of parent field and filter field. If setup, the filtering of lookup
table records will be based on 4 fields.

Allow add
Optional. If enabled, the user will be allowed to add an option to the selection list.

Notes

1. Review your lookup table design before using this option. The option works best if you there is only one display
field and the link field (primary key) is an autoincrement field. In that case the user only need to fill in a textbox and
the option is added. But if the link field (primary key) is not an auto-increment field, the user will need to enter the
link field value which the user may not know.
2. The user will be asked to enter the link field and the display field(s) only. If the lookup table has other NOT NULL
fields other than the link field and display field(s), the new option cannot be added. However, you can define default
values for these fields in the database (not in PHPMaker).
3. This feature is implemented using Ajax.
4. Adding fields other than the link field, display fields and filter field is allowed. Click the [...] button and select
additional fields in the lookup table. However, please note that this feature is designed for adding a lookup value
on-the-fly only, it is NOT supposed to replace the full-featured Add page of the lookup table. Although file upload
and JavaScript features such as popup calendar and DHTML editor are also allowed (v9+), there may be chances
that they do not work properly in the popup form. You should choose as few fields as possible. Also, note that the
add option form for each lookup table is shared among all fields (possibly in different tables) using the same lookup
table. If you change the fields to be added to the lookup table, the shared add option form will affect other fields as
well.

Auto fill
Optional. If enabled, the script fills the target fields for you automatically.
For example, when you select a product number (which is a lookup field using the product table as its lookup table), it will
fill product price textbox for you.

Note Before using Auto-Fill, review your database design, you should consider database normalization, in many cases
you do NOT need to and you should NOT copy the field values from one table to another. You can view the other field
values by creating a query/view joining the current table with the lookup table using the parent field as linked field.

The required conditions are:

1. The field has Lookup Table and Link field,


2. The field is setup as Radio or Select with Multiple disabled (i.e. "select-one" only),
3. Auto fill is enabled,
4. Source Fields and Target Fields are set up.

If properly set up, when the user changes the selected value of the field, the scripts will try to use other field values
(specified by [Source Field]) of the selected record (from the lookup table) to fill the target fields of the current table
(specified by [Target Field]) automatically.
Click the [...] button and select the source fields and target fields:

Note Remember that the actual field values of the Source Field and Target Field as stored in the database will be used.
The data types of the Source Field and the Target Field must match. If the Source Field has Lookup Table, its actual field
value (NOT its Display Field value) is used. Similarly, if the Target Field has Lookup Table, you should fill it with a Source
Field value that matches its actual field value (NOT its Display Field value).

In this example, when you select a product from combobox, the script know the product ID from the option value, so it can
use the ID to locate the product from the same lookup table (your product table) and retrieve other field values such as the
product unit price and fill the target fields.

Note Do NOT setup fields to autofill each other. For example, if you set up field A to autofill field B (A -> B) and B -> A, it
will be an infinite loop. Similarly, if you setup A -> B and B -> C and C -> A, it will not work either.

Allow sort/search
Enable sorting and searching of the looked-up values. For use with Select (combobox) or Radio or Text Edit Tag only.
Since display values are field values in the lookup table (not in the main table), they are retrieved dynamically by code
during execution of the script and normally the field cannot be sorted or searched by the display values. PHPMaker makes
it possible by adding a subquery to the SQL to create a virtual field in the main table.

Limitations

1. No multiple selection. Select Edit Tag with Multiple enabled and Checkbox Edit Tag are not supported.
2. No lookup table filter or table filter. If the lookup table has filter, the subquery becomes too complex and the
SQL will not be supported by the database. The table filter and lookup table filter will be ignored.
3. May not work with all databases. With subqueries the SQL become more complex than usual, especially for
Custom View, the SQL may not be supported by your database. (This is another reason why you should always
use database query/view whenever possible, see Using Custom View.)
4. Enable as few fields as possible. Since the SQL become more complex, there is performance penalty, so do not
blindly enable this feature for all lookup fields.

Text input for search


Enable text input for the field in the search forms. For use with Select (combobox) or Radio or Text Edit Tag with Allow
sort/search enabled.
If Edit Tag is not Text (i.e. Select or Radio) and you have enabled Allow sort/search, you may want to search with a
textbox instead of combobox or radio buttons. If so, enable this setting. Note that if Edit Tag is Text and you have enabled
Allow sort/search, the input is textbox, this setting is enabled automatically even you have not checked this setting to
enable it explicitly.

Note NOT compatible with Dynamic Selection Lists. When this option is enabled, the form element value (and the
submitted value) is always the text input (not the Link field value) for searching to work. Therefore, if the field is a parent
field in Dynamic Selection Lists (see below), the child fields may not work in the search forms.

Dynamic Selection Lists


PHPMaker supports Dynamic Selection Lists in which child lookup fields' selection list options change dynamically based
on option selected in the parent selection list. To setup child lookup fields, click the [Child lookup fields...] button and the
following setup form will be displayed:
Read Tutorial - Dynamic Selection List for more information.

Validation (for Add/Copy/Edit/Search)


The data input for each field can be validated using client-side JavaScript.

Validate
Supported validation formats are:

Integer
Float
Range
Date(yyyy/mm/dd) - also allows yy/mm/dd and date with time
Date(mm/dd/yyyy) - also allows mm/dd/yy and date with time
Date(dd/mm/yyyy) - also allows dd/mm/yy and date with time
Time(hh:mm:ss)
Email
Credit card
GUID
US phone number
US zip code
US social security number
Regular Expression

Notes

1. For simplicity the validation format indicates the date format with "/" as date separator, but the actual date
separator used in the scripts is determined by the Default date format setting (see PHP Settings).
2. If Regular Expression, client side and server side arguments must be entered, depend on if you have enabled
client-side and server-side validation (see PHP Settings), see Arguments (Client-side) and Arguments (Server-
side) below.
3. You can add your own functions for validation. The function must accept at least one argument (the value) and
return true (valid value) or false (invalid value). If your functions requires additional arguments, see Arguments
(Client-side) and Arguments (Server-side) below. You can add your function names (comma separated) in the
Advanced Setting CustomValidationFunctions. (See Tools.) Note that since it is both JavaScript and PHP
function name, it must be a string that corresponds to a valid identifier for both sides. For example, you can enter
"myValidateFunction1,myValidateFunction2" (no quotes). If you have enabled Client-side (JavaScript) validation
(see PHP Settings), you need to provide your JavaScript function. If you have enabled Server-side validation (see
PHP Settings), you need to provide your PHP function. You can put your functions in the Global Code section
under Server Events and Client scripts respectively (see Server Events and Client Scripts) so they are available
for use in the generated scripts.

Arguments (Client-side)
Arguments for the JavaScript functions for validation. For Regular Expression and custom validation functions only.
Note This is JavaScript arguments, it should be comma separated (if more than one) JavaScript expressions. e.g. If it is a
string, it must be single or double quoted.

If the Validate setting (see above) is Regular Expression, this setting must be a valid JavaScript regular expression
pattern along with flags that identify how to apply the pattern (delimit the pattern by "/" characters, not single or double
quotes), e.g.
/foobar/i
See Creating a Regular Expression for more information about the pattern and flags.

Arguments (Server-side)
Arguments for the PHP functions for validation. For Regular Expression and custom validation functions only.

Note This is PHP arguments, it should be comma separated (if more than one) PHP expressions. e.g. If it is a string, it
must be single or double quoted.

If Regular Expression, arguments must be the the pattern to search for, as a single or double quoted string, e.g.
'/foobar/i'
See PHP function preg_match for more information about the pattern.

Use popup calendar


Check this option to use a JavaScript date picker instead of manual input.

Notes

1. This option is only available for date validation formats (with or without time): Date(yyyy/mm/dd),
Date(mm/dd/yyyy), Date(dd/mm/yyyy). You must select one of these validation formats first.
2. The popup calendar is not developed by the author of PHPMaker and no technical support will be provided. (See
Third-party Tools.)

Required
Check this checkbox if the field is mandatory.

Notes

1. If the field is defined as NOT NULL in your database, the field is required even this option is not enabled.
2. By default required fields will be denoted by an asterisk beside the field caption. You can change the asterisk to
other or remove it in the language file.

Error message
Enter the error message to popup if error occurs.

Note If you use Multi-Language (see PHP Settings), use Multi-Language Property Editor, see Tools for details.

Check duplicate
Specify whether to check duplicate values for the field before editing or inserting a record.
If the field is an unique indexed field, PHPMaker will generate server side codes to check duplicate values automatically
even this option is not selected. This option is useful when you want to check a non unique indexed fields for duplicated
values.

Add Page
Properties
Add
Show field in add page

Note The setting is for Add page only, NOT for Inline/Grid-Add/Edit and Master/Detail-Add Edit in the List page. See the
List setting above.

Default Value
Default value for field (for adding new record only) .
The value must be a valid PHP expression. (If it is a string, must be single or double quoted.)

Multi-Update Page

Properties
Multi-Update
Show field in Multi-Update page
If a field is selected, it will be included in the Multi-Update page. In the generated Multi-Update page, there is a checkbox
for each field, the field will only be updated if the checkbox is checked so users can update only the checked fields without
affecting values of the other unchecked fields.

Advanced Search Page

Properties
Search
Show field in Advanced Search page (Note: NOT related to Quick Search)

Search Opr 1
Search operator #1 for the field. Used in Advanced Search or Extended Quick Search.

Default Value
Default value for Search Opr 1.
The value must be a valid PHP expression. (If it is a string, must be single or double quoted.)

Search Opr 2
Search operator #2 for the field. Used in Advanced Search or Extended Quick Search.

Notes

1. This second search operators will be useful when you need 2 criteria for the field when searching. You can also
select AND/OR to relate the 2 criteria during runtime.
2. If you want to use "BETWEEN" search operator, select "BETWEEN" as the first search operator. Since
"BETWEEN" requires 2 search criteria, when it is used, the second search operator will be ignored.
Default Value 2
Default value for Search Opr 2 .
The value must be a valid PHP expression. (If it is a string, must be single or double quoted.)

Server Events and Client Scripts

You can implement your own business logic by writing your own server events and client scipts. Your code is stored in the
project so you can migrate your project to other templates or future versions easily. This feature reduces the need of
template customization and create maximum possibilities for you to customize and create more advanced features for your
projects.
After loading the database, the database objects (tables, views, custom views and reports) will be shown in the left pane
(the database pane). Click on any table to go to the Field Setup Page and then select the Code tab (which contains Server
Events, Client Scripts and Custom Templates).
Note: For simplicity, we use "table" in the following description to refer to any of database object in the project. A database
object can be either a table, a view, a custom view or a report.

The treeview shows the available server events and client scripts that you can add to your project:
Server Events Server-side PHP procedures
Global The events are applicable to all PHP pages

Table-Specific The set of events are table-specific, the events are applicable to the selected table only
Other The events are applicable to some common pages in the project only

Client Scripts Client-side JavaScript


Global The JavaScript are included in all pages with header and footer
Table-Specific The JavaScript are table-specific, they are included to pages for the selected table only

Other The JavaScript are included in some common pages in the project only
To add your custom scripts to the server events or client scripts, select an item in the treeview, then enter your code in the
editor.
The editor supports Find and Replace. Press Ctrl-F to open the Find dialog and press Ctrl-H to open the Replace dialog.
You can click the [Clear] button to discard the existing code and reset template code for the server event or client script.

Code Repository
PHPMaker provides a Code Repository for easy reuse of your code across projects and sharing with other users. Click the
[Code Repository] button to open it, categorized reusable code will be displayed:

You can add the code to the editor by clicking the [Add to Editor] button, or by double-clicking the item, or simply drag the
item to the editor. The reusable code is stored in XML files which reside in s subfolder name "code" under the installation
folder. The format of the XML files is simple, there are 3 parts:
1. description - description of the reusable code
2. code - code to be inserted to editor
3. globalcode - common code to be inserted to Global Code (see below), this code will only be inserted once into the
project. For example , if your code is used several times in your project and your code calls a helper function, it is
unnecessary to include the helper function several times. In this case you put your helper function in the
globalcode section, then the function will only be included one time.

There are a few example files in the "code" folder, you can copy and modify for your own code and then save them under
the "code" folder for reuse.

Server Events
In general, server events are fired in the following order:
Page_Loading (Global function)
Page_Load (Page class method)
Page_Rendering (Global function)
Page_Render
Page_DataRendering
<Page>.RecordSet_* / Row_* (Page/Table class method)
Page_DataRendered
Page_Unload (Page class method)
Page_Unloaded (Global function)

Notes

1. From v9, the page class inherit from the table class, so you can use $this in the page class methods to access
table class members. For backward compatibility, the table object is kept and it is an alias of the page object, so
you can also use $this in the table class methods to access page class members.
2. The Page_Unload and Page_Unloaded are server side events to be fired every time the page is accessed and
before the HTML is outputted to the browser on the client side. They are NOT events to be fired before you leave
the page and reload the page or go to another page. For example, if you submit a form in the page, usually it
submits to the page itself, you are actually reloading the page, all server events will be fired again. For another
example, if you click a hyperlink which links to another page, the page on the server side is not even accessed
again and no server events for the page will be fired.
3. If a server event is a global function, there is NO $this in the function context. If you want to refer to the current
page object, you can use the global function CurrentPage().
4. In the following table, the <fieldname> in code, e.g. in $this-><fieldname>-><property> or x_<fieldname>,
represents the field variable name. In general, the field name is alphanumeric, field variable name is same as the
field name. Otherwise, spaces are replaced by underscores, and other non alphanumeric characters are replaced
by their hexadecimal string representation of their unicode value. If the variable is a reserved word or starts with a
digit, it will be prepended with an underscore. If you are not sure, drag a field from the database pane to the editor
instead of typing the field variable name. However, note that if the field name is quoted, e.g. as a key in
$rs['<fieldname>'], <fieldname> is the actual field name as in the database, not the field variable name.
5. Server events are functions or class methods, if you need to use global variables in the events, note the PHP
variable scope, you must use the global keyword or $GLOBALS.

Available server events are:


Global -> All Pages
Page_Head

The code you entered in this event will be placed in the header.php before closing the <head> section. You
can use this event to can add your code in head section. Note: This is a global function.
Example
PHPMaker does NOT use jQuery UI, but you can include it yourself (using CDN):
ew_AddStylesheet("http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css");
// Add CSS stylesheet
ew_AddClientScript("http://code.jquery.com/ui/1.10.3/jquery-ui.js"); // Add
JavaScript
Then you can use the widgets using Startup Script (see below).

Database_Connecting
This event will be called by all PHP pages before connecting to the database. Note: This is a global
function.
If MySQL/PostgreSQL, the argument is an array with the following keys: host, port, user, pass, db. If
Access/MSSQL, the argument is the connection string for ADO. You can use this event to change the
connection string (e.g. changing connection info with server, or even connect to other databases).
Example 1
// MySQL/PostgreSQL
function Database_Connecting(&$info) {
//var_dump($info);
// assume the scripts are generated with connection info for local PC
if (ew_CurrentUserIP() <> "127.0.0.1") { // not connecting to local PC
// connect to the production database
$info["host"] = "localhost";
$info["user"] = "xxx";
$info["pass"] = "yyy";
$info["db"] = "production_db";
}
}
Example 2
It is possible to use single login and common Dynamic User Levels for multiple projects provided that ALL
projects use the same project name and same Advanced Security tables (i.e. User Table, User Level Table
and User Level Permission Table). If all projects uses the same database and same Advanced Security
tables, then the latter condition is auto fulfilled. However, if the projects use different databases, you can use
this event to change the connection info so the user can get the Dynamic User Levels from the common
Advanced Security tables correctly during login, e.g.
// MySQL/PostgreSQL
function Database_Connecting(&$info) {
//var_dump($info);
if (preg_match('/login|userpriv/', CurrentPageID()) { // login.php or userpriv.php
// connect to the common database with the common Advanced Security tables
$info["host"] = "localhost";
$info["user"] = "xxx";
$info["pass"] = "yyy";
$info["db"] = "common_db";
}
}

Database_Connected
This event will be fired by all PHP pages after connecting to the database. Note: This is a global function.
The argument is the connection object, you can use it to execute your own statements.
Example
Call a stored procedure after connection.
function Database_Connected(&$conn) {
$conn->Execute("CALL MyStoredProcedure");
}

Page_Loading

This event will be called by all PHP pages at the beginning of the page. If the pages involves database
connection, it will be called after connecting to the database and before the Page_Load event. Note: This is
a global function, NOT page class member.

Page_Rendering
This event will be called by all PHP pages before outputting HTML for the page. Note: This is a global
function, NOT page class member.
Page_Unloaded
This event will be called by all PHP pages at the end of the page. If the pages involves database connection, it
will be called before closing database connection and after the Page_Unload event. Note: This is a global
function, NOT page class member.
Global Code
Code to be included in all PHP pages. This may contain your constants, variables and functions.
User_CustomValidate
For use with security. (See Security Settings) This event is fired before default user validation. You can use
this event to validate the user yourself. The arguments are the user name and password the user entered.
Return TRUE if the username and password pass your custom validation. Note: This event is a security
class member.
Note From v9, default validation will continue after this event is fired. If you return TRUE, the user will always
pass the default validation and get the User ID and User Level, if any. If you return FALSE, the default
validation proceeds as normal. If you use Advanced Security, you still need the user table to store user
information such as User ID and User Level, although the password field value can be empty or any value if
you return TRUE.
Example 1
Login user by Windows user name.

// Note: This event is a Security class member, so you can refer to other members of the Security class directly

function User_CustomValidate(&$usr, &$pwd) {

// e.g. Simple Windows authentication

if (ew_ServerVar("LOGON_USER") <> "") {

$usr = ew_ServerVar("LOGON_USER");

return TRUE;

}
}

Example 2
Login user by LDAP. (The following example code can be found in Code Repository.)

// Note: This event is a Security class member, so you can refer to other members of the Security class directly

function User_CustomValidate(&$usr, &$pwd) {

// e.g. LDAP authentication example for User_CustomValidate server event

if (!function_exists("ldap_connect"))

die("LDAP extension not installed.");

$ldapconn = ldap_connect("ldap.example.com", 389) or die("Could not connect to LDAP server."); // Note:


Replace the host name and port

if ($ldapconn && ldap_bind($ldapconn, $usr, $pwd)) {

$this->setCurrentUserName($usr); // Set the current user name

return TRUE;

}
User_Validated
For use with security. (See Security Settings) This event is fired after successful user login. The user info is
passed to the event as an array (see note), you can get more info of the user and use it as you need. Note:
This event is a security class member.
Notes

1. This event is not fired for the hard-coded administrator.


2. The argument $rs is an array, you can get a field value by $rs['<fieldname>'].

Example
Add current user's country to session variable

// Note: This event is a Security class member, so you can refer to other members of the Security class directly

function User_Validated(&$rs) {

$_SESSION["UserCountry"] = $rs['Country'];

}
UserLevel_Loaded
For use with User Level security. (See Security Settings) This event is fired after successful user login and
after the User Level settings are loaded. It is possible to do actions such as changing or adding User Level
permissions. Note: This event is a security class member.
Example
Change the permissions of an User Level for a table

// Note: This event is a Security class member, so you can refer to other members of the Security class directly

function UserLevel_Loaded() {

$this->DeleteUserPermission("Sales", "orders", EW_ALLOW_ADD);


$this->AddUserPermission("Sales", "orders", EW_ALLOW_EDIT);

}
MenuItem_Adding

This event is fired for custom menu items before it is added to the menu. The menu item info is passed to the
event as an instance of the cMenuItem object (see below). Return FALSE if you don't want to show the menu
item. If you return TRUE, the menu item will be added to the menu, but it does not mean that it will be always
displayed. A menu item will be displayed only if its Allowed property is TRUE. When the menu item is passed
to this event, the Allowed property is set based on the User Level Security of the project, you can however
change it by setting $Item->Allowed as TRUE or FALSE as needed. Note: This is a global function.
Example
Only show a menu item after the user has logged in
function MenuItem_Adding(&$Item) {
//var_dump($Item);
// Return False if menu item not allowed
if ($Item->Text == "Download") {
return Security()->IsLoggedIn();
} else {
return TRUE;
}
}

Menu_Rendering
This event is fired before the menu is rendered. You can manipulate the menu items in this event. The
argument is the menu object. (See Menu Object below.) Note: This is a global function.
Example 1
Add an additional menu item to the menu for logged in users only.
function Menu_Rendering(&$Menu) {
if ($Menu->IsRoot) { // Root menu
$Menu->AddMenuItem(10000, "MyMenuText", "MyPage.php", -1, "", IsLoggedIn());
$Menu->MoveItem("Logout", $Menu->Count() - 1); // Move to last
}
}
Example 2
Remove all the default menu items and use your own menu items.
function Menu_Rendering(&$Menu) {
if ($Menu->IsRoot) { // Root menu
$Menu->Clear();
$Menu->AddMenuItem(1, "MyMenuText1", "MyPage1.php");
$Menu->AddMenuItem(2, "MyMenuText2", "MyPage2.php");
}
}

TablePermission_Loading

For use with User Level security. (See Security Settings) This event is fired before the user permission for the
table of the current page is loaded. It is possible to do actions such as changing or adding more User Level
permissions to the current user. Note: This event is a security class member.
Note This is an event fired for the current table only. If you change the permissions of the other tables in
this event, there will be no effect. Use the UserLevel_Loaded event if you need to change permissions of
other tables.
Example
Grant another User Level to the user and let the user have permissions of more than one User Level for the
current table.
// Note: This event is a Security class member, so you can refer to other members of the Security class directly
function TablePermission_Loading() {
if (CurrentUserName() == "nancy")
$this->AddUserLevel("Manager");
}
TablePermission_Loaded
For use with User Level security. (See Security Settings) This event is fired after the user permission for the
table of the current page is loaded. It is possible to to change the permission by using the setCanXXX
methods of the Security class. Note: This event is a security class member.
Note This is an event fired for the current table only. If you change the permissions of the other tables in
this event, there will be no effect. Use the UserLevel_Loaded event if you need to change permissions of
other tables.
Example
Grant more permissions to the user and let the user have more permissions than his/her User Level allows for
the current table.

// Note: This event is a Security class member, so you can refer to other members of the Security class directly

function TablePermission_Loaded() {

if (CurrentUserName() == "nancy" && CurrentTable()->TableName = "orders")

$this->setCanEdit(TRUE);

}
UserID_Loading
For use with User ID security. (See Security Settings) This event is fired after successful user login and before
loading the User ID and its child User IDs of the current user. These User IDs determine which records the
current user can access. It is possible to do actions such as changing the User ID of the current user so the
user can access records that he/she can access by its original User ID. Note: This event is a security class
member.
Example
Change the user's User ID to his parent user's user ID and let the user access more records (accessible by
the parent user).

// Note: This event is a Security class member, so you can refer to other members of the Security class directly

function UserID_Loading() {

if (CurrentParentUserID() <> "")

$this->CurrentUserID = CurrentParentUserID();

}
UserID_Loaded

For use with User ID security. (See Security Settings) This event is fired after loading the User ID and its child
User IDs of the current user. These User IDs determine which records the current user can access. It is
possible to do actions such as adding or deleting the loaded User IDs for the current user so the user can
access more or less records that he/she can access by its originally loaded User IDs. Note: This event is a
security class member.
Example
Add more User IDs to the user and let the user access more records

// Note: This event is a Security class member, so you can refer to other members of the Security class directly

function UserID_Loaded() {

if (CurrentUserName() == "nancy")

$this->AddUserID($this->GetUserIDByUserName("janet"));

}
User_PasswordExpired
This event will be called if the user password is already expired. User information is passed to the event as
argument, you can get user information by $rs["<fieldname>"] where <fieldname> is a field name of the user
table. Note: This event is a security class member.

Table-Specific -> Common (Note: These events are members of the page class)
Recordset_Selecting
This event will be called before selecting records. The argument of the event is the filter (part of the WHERE
clause of the SQL) for selecting records, you can customize the filter to change the records to be selected.
Example
Add your own filter. Note that the $filter may have value, append your filter to it, not replace it.

function Recordset_Selecting(&$filter) {

ew_AddFilter($filter, "Field1 = 1234"); // Add your own filter expression

}
Recordset_Selected
This event will be called after selecting records. Note: The argument is the recordset object (not array).
Recordset_SearchValidated
This event will be called after the Form_CustomValidate event and the search criteria is assigned to the
table/field objects. You can modify the search criteria in this event.
This event is a member of the table class. There is no arguments for this event. To change the Quick Search
criteria, change the BasicSearchKeyword and BasicSearchType property of the table object. To change the
Advanced Search criteria, change the AdvancedSearch property (which is an object of the cAdvancedSearch
class) of the field object.
Example

function Recordset_SearchValidated() {

$this->MyField1->AdvancedSearch->SearchValue = "your search criteria"; // Search value

}
Recordset_Searching
This event will be called before the search criteria is saved for the session. The argument of the event is the
part of WHERE clause built from the Quick/Extended Quick/Advanced search criteria. You can modify the
WHERE clause in this event.
Row_Deleting
This event will be called before deleting a record. The argument of the event is the record to be deleted as an
array.
Row_Deleted

This event will be called after deleting a record. The argument of the event is the record deleted as an array.
Example
Delete detail records from the detail table after the master record is deleted.

function Row_Deleted(&$rs) {

// Assume ForeignKeyField is of integer type

ew_Execute("DELETE FROM DetailTable WHERE ForeignKeyField=" . $rs["PrimaryKeyField"]);

}
Row_Inserting
This event will be called before inserting a record. The arguments of the event are the arrays of the old (if
copying record) and new record to be inserted. You can change the values in the $rsnew.
Example
Make sure a field value is valid.
function Row_Inserting(&$rsold, &$rsnew) {

if ($rsnew["Percentage"] > 100)

$rsnew["Percentage"] = 100;

// To cancel, set return value to False

return TRUE;

}
Row_Inserted
This event will be called after inserting a record. The arguments of the event are the arrays of the old (if
copying record) and new record just inserted.
Example
Get the ID (autoincrement field) of the just inserted record

function Row_Inserted(&$rsold, &$rsnew) {

$this->setSuccessMessage("Record Inserted. The ID of the new record is " . $rsnew["ID"]);

}
Row_Rendering
This event will be called before rendering (applying the View/Edit Tag settings) a record.
Row_Rendered

This event will be called after rendering a record.


This is an extremely useful event for conditional formatting, you can do a lot of things with this event, such as
changing font color, font styles, row background color, cell background color, etc. by changing the table or
field class properties in the event according to field values.
Note The table class has a RowAttrs property which is an associative array of HTML attributes for the table
row. The field class has CellAttrs, ViewAttrs and EditAttrs for the table cell, View Tag and Edit Tag of the
field respectively. The keys of these arrays must be valid HTML attributes for the HTML tag, always use
lowercase for the keys. The attribute values will be outputted as double quoted attributes, so if you have
double quotes in your values, try to use single quotes if possible, or use "&quot;".
To view the properties of the field class for development or debugging, you can use the PHP's var_dump
function in the server event, e.g.
var_dump($this->RowAttrs);
var_dump($this->Trademark);
var_dump($this->Trademark->CellAttrs);
var_dump($this->Trademark->EditAttrs);
var_dump($this->Trademark->ViewAttrs);
Example
Click "Cars" node on the database panel, select [Server Events/Client Scripts], and click [Table Specific] -
> [Common] - > [Row_Rendered] server event. The default Row_Rendered event code is shown. Change
as follow:

function Row_Rendered() {

// Change the row color in List page

if ($this->Trademark->ViewValue == "BMW") {

$this->RowAttrs["style"] = "color: red; background-color: #ccffcc";

}
// Change the cell color

if ($this->Cyl->CurrentValue == 4) {

$this->Cyl->CellAttrs["style"] = "background-color: #ffcccc";

} elseif ($this->Cyl->CurrentValue == 6) {

$this->Cyl->CellAttrs["style"] = "background-color: #ffcc99";

} elseif ($this->Cyl->CurrentValue == 8) {

$this->Cyl->CellAttrs["style"] = "background-color: #ffccff";

// Change text style

if ($this->Category->CurrentValue == "SPORTS") {

$this->Category->ViewAttrs["style"] = "color: #00cc00; font-weight: bold; background-color: #ffff99";

Row_Selecting

This event will be called before selecting a record. The argument of the event is the filter (part of the WHERE
clause of the SQL) for selecting the record, you can customize the filter to change the record to be selected.
Row_Selected
This event will be called after selecting a record. The argument is the record selected as an array.
Row_UpdateConflict
This event will be called if conflicts is found before updating a record (if Check Conflicts is enabled, see Table
Setup). The arguments of the event are the old record (as array) and new record (as array) to be updated.
You can use this event to resolve the conflicts according to your own criteria. If you want to ignore conflicts or
you have resolved the conflicts in the event (by setting new values to the argument rsnew) and want to
continue update, return FALSE. Otherwise, return TRUE. By default the event returns TRUE.
Row_Updating

This event will be called before updating a record. The arguments of the event are the arrays of the old and
new record to be updated.
Example
Make sure a field value is not changed

function Row_Updating(&$rsold, &$rsnew) {

if ($rsnew["Qty"] < $rsold["Qty"]) {

// To cancel, set return value to False

$this->CancelMessage = "The new quantity must be larger than the old quantity.";

return FALSE;

} else {

return TRUE;
}

}
Row_Updated

This event will be called after updating a record. The arguments of the event are the arrays of the old and new
record updated.
Example
After updating a field in detail table, update a field in the master table.

function Row_Updated($rsold, &$rsnew) {

//var_dump(rsold, rsnew); die(); // Print the old and new record and end the script

$rs = array();

$rs["FieldInMasterTable"] = $rsnew["FieldInDetailTable"]; // Set field values

(new cMasterTable())->Update($rs, "PrimaryKeyFieldInMasterTable = " +


rsnew["ForeignKeyFieldInDetailTable"]); // Note: Table class is named as c<TableName>. Assume
PrimaryKeyFieldInMasterTable is integer.

}
Email_Sending
This event is fired before the email notification is sent. You can customize the email content using this event.
Email_Sending event has the following parameters:
Email - the email object instance which contain all the information about the email to be sent. It is an instance
of the cEmail class (see below).
Args - an array which contains additional information.
If Add, the new record in the format of array can be access by $Args["rsnew"]. If Copy, the old record in the
format of array can be access by $Args["rsold"]. If Edit/Update, the old data of the records in the format of
array can be access by $Args["rsold"], the new data of the records in the format of array can be access by
$Args["rsnew"]. If Register, the new record in the format of array can be access by $Args["rs"]. You can get a
field value by, e.g.

$rsnew = $Args["rsnew"];

$MyValue = $rsnew["MyField"];

or

$MyValue = $Args["rsnew"]["MyField"];

Return FALSE in the event if you want to cancel the email sending.
If Grid-Add/Edit or Update page, there are more than one records, the arguments are array of array.
Example
Assume there is an email field in the record, and you want to change the recipient to the value of that field.

function Email_Sending(&$Email, &$Args) {

//var_dump($Email);

//var_dump($Args);

//exit();

if (CurrentPageID() == "add") { // If Add page

$Email->Recipient = $Args["rsnew"]["MyEmailField"]; // Change recipient to a field value in the new record


$Email->Subject = "My New Subject"; // Change subject

$Email->Content .= "\nAdded by " . CurrentUserName(); // Append additional content

return TRUE;

}
Lookup_Selecting
This event is fired before selecting records from the lookup table. You can use this event to change the filter,
Example 1
Modify the lookup table filter when a selection list looks up display values from the lookup table.

function Lookup_Selecting($fld, &$filter) {

if ($fld->FldName == "MyLookupField")

$filter = str_replace("xxx", "yyy", $filter);

Example 2
Add filter to the lookup table filter

function Lookup_Selecting($fld, &$filter) {

if ($fld->FldName == "MyLookupField")

ew_AddFilter($filter, "MyField = 'xxx'"); // Assume the field is of string type

}
UserID_Filtering

For use with User ID security. (See Security Settings) This event is fired before adding the User ID filter to the
WHERE clause of the table. It is possible to modify, replace or add filter so the user can access more or less
records that he/she can access by its originally loaded User IDs.
Example
Assume you have 2 User ID fields in the current table and in the user table, and you want to filter by both User
ID fields.

function UserID_Filtering(&$filter) {

ew_AddFilter($filter, "MyUserIDField2 = " . CurrentUserInfo("MyUserIDField2InUserTable")); // Assume the field


is of integer type

Table-Specific -> Add/Copy page


Page_Load
This event will be called after connecting to the database.
Page_Render
This event will be called before outputting HTML for the page. You can use this event to make some last
minute changes to the page before it is outputted.
Page_Unload
This event will be called before closing database connection.
Page_DataRendering

This event will be called after the header.php is included. You can use this event to add content at the top of
page content.
Page_DataRendered

This event will be called before the footer.php is included. You can use this event to add content at the bottom
of page content.
Page_Redirecting
This event will be called before redirecting to other page. The argument is the URL to be redirected to.
By default after inserting a record user is redirected back to the List page. You can change that by using
Return Page (see Table Setup). However, If you want to change by code, you can also use this event.

Message_Showing
This event is fired before the message stored in the session variable is shown.
The first argument $msg is the message to be shown, the second argument $type is the type of the message,
possible values of type are: "" (empty string), "success", "failure", and "warning".
Example
Replace an error message by custom message

function Message_Showing(&$msg, $type) {

if ($type == 'success') {

//$msg = "your success message";

} elseif ($type == 'failure') {

if (strpos($msg, "some standard message") !== FALSE)) // The original message contains some keywords you
want to replace

$msg = "My custom message";

} elseif ($type == 'warning') {

//$msg = "your warning message";

} else {

//$msg = "your message";

}
Form_CustomValidate

This event is fired after the normal form validation. You can use this event to do your own custom validation. In
general, the form data can be accessed by $this-><Field>->FormValue (e.g. $this->HP->FormValue).
Alternatively, you can get all the form values in an array first, e.g.

$rs = $this->GetFieldValues("FormValue");

An argument $CustomError is passed to the event, you can add your error message and return FALSE if the
form values do not pass your validation.
Example
Make sure an integer field value meet a certain requirement

function Form_CustomValidate(&$CustomError) {

$rs = $this->GetFieldValues("FormValue"); // Get the form values as array

if (intval($rs["Qty"]) % 10 <> 0) {
// Return error message in $CustomError

$CustomError = "Order quantity must be multiples of 10.";

return FALSE;

} else {

return TRUE;

Table-Specific -> Delete Page


Page_Load
This event will be called after connecting to the database.

Page_Render
This event will be called before outputting HTML for the page. You can use this event to make
some last minute changes to the page before it is outputted.

Page_Unload
This event will be called before closing database connection.
Page_DataRendering
This event will be called after the header.php is included. You can use this event to add content
at the top of page content.
Page_DataRendered
This event will be called before the footer.php is included. You can use this event to add
content at the bottom of page content.
Message_Showing

This event is fired before the message stored in the session variable is shown. You can use this
event to change the message which is passed to the event as argument.
Page_Redirecting

This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
By default after deleting record(s) user is redirected back to the List page. You can change that
using this event.

Table-Specific -> Edit Page


Page_Load
This event will be called after connecting to the database.
Page_Render
This event will be called before outputting HTML for the page. You can use this event to
make some last minute changes to the page before it is outputted.
Page_Unload
This event will be called before closing database connection.
Page_DataRendering
This event will be called after the header.php is included. You can use this event to add
content at the top of page content.

Page_DataRendered
This event will be called before the footer.php is included. You can use this event to add content at the bottom
of page content.

Message_Showing

This event is fired before the message stored in the session variable is shown. You can use this event to
change the message which is passed to the event as argument.

Page_Redirecting
This event will be called before redirecting to other page. Event argument is the URL to be redirected to.
By default after updating a record user is redirected back to the List page. You can change that by using
Return Page (see Table Setup). However, If you want to change by code, you can use this event.

Table-Specific -> List Page


Page_Load
This event will be called after connecting to the database.
Note The export links are stored as a cListOptions object (also see ListOptions_Load and
ListOptions_Rendered event below), you can manipulate the links in the same way. The defaut names of the
options are:

print
html
excel
word
xml
csv
pdf
email

Note that the names are in lowercase and are case-sensitive.


Example 1
Hide the export to PDF link in List page:

function Page_Load() {

$item = @$this->ExportOptions->Items["pdf"];

if ($item)

$item->Visible = FALSE;

Example 2
Add a custom link at the end of the export links

function Page_Load() {

$item = &$this->ExportOptions->Add("MyName");

$item->Body = "<a href='MyURL'>My Link</a>";

Example 3
Add a custom action to the page

function Page_Load() {

$this->CustomActions["star"] = "Add Star"; // Where "star" is the id and "Add Star" is the caption of the custom
action

To process the action, use Row_CustomAction server event (see below).


Page_Render

This event will be called before outputting HTML for the page. You can use this event to make some last
minute changes to the page before it is outputted.
Example
Customize the breadcrumb

function Page_Render() {

Breadcrumb()->Divider = "&gt;"; // Change the breadcrumb divider to ">"

}
Page_Unload
This event will be called before closing database connection.
Page_DataRendering

This event will be called after the header.php is included. You can use this event to add content at the top of
page content.

Page_DataRendered

Page_Redirecting
This event will be called before the footer.php is included. You can use this event to add
content at the bottom of page content.
This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
Message_Showing
This event is fired before the message stored in the session variable is shown. You can use
this event to change the message which is passed to the event as argument.
Form_CustomValidate
This event is fired after the normal form validation. You can use this event to do your own
custom validation. See description of Form_CustomValidate for Add/Copy page above.
ListOptions_Load
This event will be called before the main table is rendered. Use this event to modify the non
data columns of the main table (i.e. the links and the checkbox for each record). You can
modify these columns or add your own columns using this event. You can get a column by
name using $this->ListOptions->Item["name"].
Note The following predefined names are reserved, do not use them for your own columns.
These names are case-sensitive and are in lowercase except for the detail table names.

checkbox
view
copy
delete
edit
detail_<DetailTable> - Detail table column
details - the Multiple Master/Detail column
preview - column for preview row of the Detail Preview extension (for registered
users) only
sequence - column for sequence number
button - column for button group or button dropdown

Example 1
Add a new column.

function ListOptions_Load() {

$item = &$this->ListOptions->Add("new");

$item->Header = "MyCaption"; // Set the column header (for List page)

$item->OnLeft = TRUE; // Link on left

$item->MoveTo(0); // Move the column to the specified index

Note If you have enabled Use buttons as links and/or Use button dropdown for links
(see PHP Settings), note that the feature will hide the list options and try to move hyperlinks
to the button group or button dropdown. If your Body property (see below) is not
hyperlink(s), it cannot be shown in the button group or button dropdown, you should remove
your list option from the button group or button dropdown by adding, e.g.
$item->ShowInButtonGroup = FALSE;
and/or
$item->ShowInDropDown = FALSE;
Example 2
Hide a column.

function ListOptions_Load() {

$this->ListOptions->Items["xxx"]->Visible = FALSE;

}
ListOptions_Rendered
This event will be called before a record is rendered. Use this event to modify content of the
non data columns for the record. To access field object of the current row, you can use
$this-><Field>-><Property> (e.g. $this->HP->CurrentValue).
Note Do NOT try to show/hide a column dynamically by setting the Visible property of the
list option in this event. If the column is visible in one row but invisible in another, the table
will be malformed. If you want to hide the content dynamically, you can set the Body
property as empty string.
Example
Set the content of the new column dynamically based on a field value.

function ListOptions_Rendered() {

if ($this->MyField->CurrentValue == "xxx") {

$this->ListOptions->Items["new"]->Body = "yyy";

} else {

$this->ListOptions->Items["new"]->Body = "";

}
Row_CustomAction
If you have used Page_Load server event (see above) to add your custom action to the List
page, the page will show the checkbox column for users to select records (similar to Multi-
Update and Mulit-Delete). When user clicks the custom action link or button, the page will
post back to itself and this event will be fired (after Page_Load and before Page_Render)
for each selected row to process the custom action.
Example
Update the status of the selected records as "starred"

function Row_CustomAction($action, $row) {

if ($action == "star")

ew_Execute("UPDATE MyTable SET Starred = 'Y' WHERE ID=" . $row["ID"]); // Assume


the field ID is of integer type

Note If you want to do something before posting back, you can add a client-side onsubmit
event to the main form (with id="f<table>list") of the List page using Startup Script (see
below).

Table-Specific -> Multi-Update Page


Page_Load
This event will be called after connecting to the database.
Page_Render
This event will be called before outputting HTML for the page. You can use this event to
make some last minute changes to the page before it is outputted.
Page_Unload
This event will be called before closing database connection.
Page_DataRendering
This event will be called after the header.php is included. You can use this event to add
content at the top of page content.
Page_DataRendered
This event will be called before the footer.php is included. You can use this event to add
content at the bottom of page content.

Page_Redirecting
This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
By default after updating records user is redirected back to the List page. You can change
that by using this event.

Message_Showing
This event is fired before the message stored in the session variable is shown. You can use
this event to change the message which is passed to the event as argument.
Form_CustomValidate

This event is fired after the normal form validation. You can use this event to do your own
custom validation. See description of Form_CustomValidate for Add/Copy page above.

Table-Specific -> Report Page


Page_Load
This event will be called after connecting to the database.
Page_Render
This event will be called before outputting HTML for the page. You can use this event to
make some last minute changes to the page before it is outputted.
Page_Unload
This event will be called before closing database connection.
Page_DataRendering

This event will be called after the header.php is included. You can use this event to add
content at the top of page content.

Page_DataRendered This event will be called before the footer.php is included. You can use this event to add
content at the bottom of page content.
Page_Redirecting
This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
Message_Showing

This event is fired before the message stored in the session variable is shown. You can use
this event to change the message which is passed to the event as argument.

Table-Specific -> Search Page


Page_Load
This event will be called after connecting to the database.
Page_Render
This event will be called before outputting HTML for the page. You can use this event to
make some last minute changes to the page before it is outputted.
Page_Unload
This event will be called before closing database connection.
Page_DataRendering

This event will be called after the header.php is included. You can use this event to add
content at the top of page content.

Page_DataRendered

This event will be called before the footer.php is included. You can use this event to add
content at the bottom of page content.
Page_Redirecting
This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
By default user is redirected to the List page after the search criteria is processed. You can
change that by using this event.
Message_Showing
This event is fired before the message stored in the session variable is shown. You can use
this event to change the message which is passed to the event as argument.

Form_CustomValidate
This event is fired after the normal form validation. You can use this event to do your own
custom validation. See description of Form_CustomValidate for Add/Copy page above.

Table-Specific -> View Page


Page_Load
This event will be called after connecting to the database.

Page_Render This event will be called before outputting HTML for the page. You can use this event to
make some last minute changes to the page before it is outputted.

Page_Unload This event will be called before closing database connection.

Page_DataRendering This event will be called after the header.php is included. You can use this event to add
content at the top of page content.
Page_DataRendered This event will be called before the footer.php is included. You can use this event to add
content at the bottom of page content.

Page_Redirecting
This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
Message_Showing
This event is fired before the message stored in the session variable is shown. You can use
this event to change the message which is passed to the event as argument.

Table-Specific -> Preview Page


Page_Load
This event will be called after connecting to the database.
Page_Render
This event will be called before outputting HTML for the page. You can use this event to
make some last minute changes to the page before it is outputted.
Page_Unload
This event will be called before closing database connection.
Page_DataRendering

This event will be called before the page content is outputted. You can use this event to add
content at the top of page content.

Page_DataRendered
This event will be called after the page content is outputted. You can use this event to add
content at the bottom of page content.

Page_Redirecting
This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
Message_Showing
This event is fired before the message stored in the session variable is shown. You can use
this event to change the message which is passed to the event as argument.

Other -> Default Page


Page_Load
This event will be called at the beginning of the page.
Page_Unload
This event will be called at the end of the page.
Page_Redirecting
This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
By default user is redirected to the default page (e.g. index.php) after successful login. You
can change that by using this event.

Other -> Login Page


Page_Load
This event will be called at the beginning of the page.
Page_Render
This event will be called before outputting HTML for the page. You can use this event to
make some last minute changes to the page before it is outputted.
Page_DataRendered
Page_Unload
This event will be called at the end of the page.
Page_DataRendering
This event will be called after the header.php is included. You can use this event to add
content at the top of page content.
Page_DataRendered

This event will be called before the footer.php is included. You can use this event to add
content at the bottom of page content.
Page_Redirecting

This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
By default user is redirected to the default page (e.g. index.php) after successful login. You
can change that by using this event.
Message_Showing
This event is fired before the message stored in the session variable is shown. You can use
this event to change the message which is passed to the event as argument.
User_LoggingIn
This event will be called before validating the username and password.
User_LoggedIn
This event will be called after the user login.
Form_CustomValidate

This event is fired after the normal form validation. You can use this event to do your own
custom validation. Inspect the HTML source of the page in your browser to view the form
element names.
An argument $CustomError is passed to the event, you can add your error message and
return FALSE if the form values do not pass your validation.
User_LoginError
This event will be called if the user fail to login.

Other -> Logout Page


Page_Load
This event will be called at the beginning of the page.
Page_Unload
This event will be called at the end of the page.
Page_Redirecting
This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
By default user is redirected to the default page (e.g. index.php) after successful login. You
can change that by using this event.

User_LoggingOut
This event will be called before user logout.

User_LoggedOut

This event will be called after user logout.


Other -> Registration Page
Page_Load
This event will be called at the beginning of the page.

Page_Render This event will be called before outputting HTML for the page. You can use this event to
make some last minute changes to the page before it is outputted.

Page_Unload This event will be called at the end of the page.

Page_DataRendering This event will be called after the header.php is included. You can use this event to add
content at the top of page content.

Page_DataRendered This event will be called before the footer.php is included. You can use this event to add
content at the bottom of page content.

Page_Redirecting This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
By default user is redirected to the default page (e.g. index.php) after successful login. You
can change that by using this event.

Email_Sending This event is fired before the email notification is sent. You can customize the email content
using this event. Email_Sending event has the following parameters:
Email - the email object instance which contain all the information about the email to be
sent. It is an instance of the cEmail class (see below).
Args - an array which contains additional information. For registration page, the new record
in the data type of a recordset can be accessed by $Args["rs"].
Return FALSE in the event if you want to cancel the email sending.

Message_Showing This event is fired before the message stored in the session variable is shown. You can use
this event to change the message which is passed to the event as argument.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own
custom validation. See description of Form_CustomValidate for Add/Copy page above.

User_Registered This event is fired after successful registration of a new user. Argument is a recordset of the
new record in the user table.

User_Activated This event is fired after activating a new user (if user activation is required, see Security
Settings). Argument is a recordset of the new record in the user table.

Other -> Change Password Page

Page_Load This event will be called at the beginning of the page.

Page_Render This event will be called before outputting HTML for the page. You can use this event to
make some last minute changes to the page before it is outputted.

Page_Unload This event will be called at the end of the page.


Page_DataRendering This event will be called after the header.php is included. You can use this event to add
content at the top of page content.

This event will be called before the footer.php is included. You can use this event to add
content at the bottom of page content.

Page_Redirecting
This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
By default user is redirected to the default page (e.g. index.php) after successful login. You
can change that by using this event.
Email_Sending
This event is fired before the email notification is sent. You can customize the email content
using this event. Email_Sending event has the following parameters:
Email - the email object instance which contain all the information about the email to be
sent. It is an instance of the cEmail class (see below).
Args - an array containing additional information. For Change Password page, the old data
of the records in the data type of recordset can be accessed by $Args["rsold"], the new data
of the records in the data type of recordset can be accessed by $Args["rsnew"].
Return FALSE in the event if you want to cancel the email sending.

Message_Showing This event is fired before the message stored in the session variable is shown. You can use
this event to change the message which is passed to the event as argument.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own
custom validation. Inspect the HTML source of the page in your browser to view the form
element names.
An argument $CustomError is passed to the event, you can add your error message and
return FALSE if the form values do not pass your validation.

Other -> Password Recovery Page

Page_Load This event will be called at the beginning of the page.

Page_Render This event will be called before outputting HTML for the page. You can use this event to
make some last minute changes to the page before it is outputted.

Page_Unload This event will be called at the end of the page.

Page_DataRendering This event will be called after the header.php is included. You can use this event to add
content at the top of page content.

Page_DataRendered This event will be called before the footer.php is included. You can use this event to add
content at the bottom of page content.

Page_Redirecting This event will be called before redirecting to other page. Event argument is the URL to be
redirected to.
By default user is redirected to the login page after successful login. You can change that by
using this event.
Email_Sending This event is fired before the email notification is sent. You can customize the email content
using this event. Email_Sending event has the following parameters:
Email - the email object instance which contain all the information about the email to be
sent. It is an instance of the cEmail class (see below).
Args - an array containing additional information. For Password Recovery Page, the old
data of the records in the data type of recordset can be accessed by $Args["rs"].
Return FALSE in the event if you want to cancel the email sending.

Message_Showing This event is fired before the message stored in the session variable is shown. You can use
this event to change the message which is passed to the event as argument.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own
custom validation. Inspect the HTML source of the page in your browser to view the form
element names.
An argument $CustomError is passed to the event, you can add your error message and
return FALSE if the form values do not pass your validation.

User_RecoverPassword This event is fired after the password is recovered. Argument is a recordset of the user's
record in the user table.

Client Scripts
In general, each page has two blocks of JavaScript:
Client Script - the first block of JavaScript to be included at the beginning of the page, you can put your JavaScript
variables and functions there. The View Tag (for display) and Edit Tag (for input) of the fields supports Custom Attributes
(See Field Setup) so you can add your own attributes to work with your own JavaScript included here.
Startup Script - the second block of JavaScript to be included at the end of the page, you can put code here to "start up"
your JavaScript.
Global -> Pages with header/footer

Client Script The script will be placed in the header and therefore included in all pages with header.
Note This event is NOT related to the No header/footer setting in the Generate form (see
Generate Settings). Even if No header/footer is enabled, this event will also be fired.

Startup Script The script will be placed in the footer and therefore included in all pages with footer. This is a very
useful event which is fired for all pages with footer, you can almost do everything by changing the
document DOM of those pages.
Note This event is NOT related to the No header/footer setting in the Generate form (see
Generate Settings). Even if No header/footer is enabled, this event will also be fired.
Example
Use jQuery to replace the logo

$("#ewHeaderRow").html('<img src="path/mylogo.png" alt="xxx">');

Global Code JavaScript code to be included in all pages with header. This may contain your global constants,
variables and functions.

Table-Specific -> Add/Copy page

Client Script The script will be placed after the header. This may contain your JavaScript variables and
functions for the page. You can also use this event to subscribe JavaScript events.
Example 1
Subscribe the jQuery ajaxSend event for Ajax requests (possible types are: "updateopt",
"autosuggest", "autofill")

$(document).ajaxSend(function(event, jqxhr, settings) {

var data = settings.data;

//alert(data); // Uncomment to view data

if (ew_Get("type", data) == "updateopt") && ew_Get("name", data) == "x_MyField")) // Ajax selection


list

settings.data = data.replace("xxx", "yyy"); // Replace data with custom data

});

Example 2
Subscribe the "rendertemplate" event for Custom Templates.

$(document).on("rendertemplate", function(e, args) {

//alert(JSON.stringify(args)); // Uncomment to view the arguments

args.enabled = false; // Disable the Custom Template

ew_ShowTemplates(args.template.substr(4)); // Show the templates with the specified class name

});

Startup Script The script will be placed before the footer. This is a very useful event which you can almost do
everything by changing the document DOM.
Example 1
Add onchange event to a field to change other fields
$("#x_Field1").change(function() {
if (this.value == "xxx") {
$("#x_Field2").val("yyy"); // Set value to field #2
} else {
$("#x_Field3").val("zzz"); // Set value to field #3
}
});

Example 2
Add onclick event to a field (checkboxes or radio buttons)

$("input[name='x_MyField[]']").click(function() {

if (this.checked) { // Checkbox is checked

// Do something

} else { // Not checked

// Do something else

});

In general, the HTML form element for the field is named as "x_FieldName", inspect the element
in your browser to check the actual name. In the event handler, this is the form element which
fired the event.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own custom
validation. The HTML form object can be accessed by the parameter fobj. In general, the HTML
form element for the field can be referred to as fobj.elements["x_FieldName"]. Note: This
function is a member of the JavaScript page class.
Return false if the form values do not pass your validation.
Example
Make sure an integer field value meet a certain requirement

function(fobj) { // DO NOT CHANGE THIS LINE!

var qty = parseInt(fobj.elements["x_Qty"].value, 10); // Assume x_Qty is a textbox

if (qty % 10 != 0)

return this.OnError(fobj.elements["x_Qty"], "Order quantity must be multiples of 10."); // Return


false if invalid

return true;

Table-Specific -> Delete Page

Client Script The script will be placed after the header.

Startup Script The script will be placed before the footer.

Table-Specific -> Edit Page

Client Script The script will be placed after the header.

Startup Script The script will be placed before the footer.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own custom
validation. The form object can be accessed by the parameter fobj. Return false if the form values
do not pass your validation.

Table-Specific -> List Page

Client Script The script will be placed after the header.

Startup Script The script will be placed before the footer.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own custom
validation. Return false if the form values do not pass your validation.
The form object can be accessed by the parameter fobj. In general, the HTML form element for
the field can be referred to as fobj.elements["x_<fieldname>"].
Note that he form element names are different in Inline-Add/Copy/Edit or Grid-Add/Edit mode of
List page. They are named as "x0_<fieldname>" in Inline-Add/Copy, as "x1_<fieldname>" in
Inline-Edit mode, and as "x1_<fieldname>", "x2_<fieldname>", etc. in Grid-Add/Edit since there
are multiple rows. Inspect the elements in your browser to check the actual form element names.
To get the element values of the current row, you can use:
var row = ew_GetRow(fobj);

Then you can use row.<fieldname> or row["<fieldname>"] to get the field element value(s). If the
form element is multiple selection (i.e. select-multiple or checkbox), the value is an array.
Deprecated! In previous versions, the form elements of the current row are added to the fobj.row
property (an array of the HTML form elements) before this event is fired. So you can use
fobj.row["x_<fieldname>"] to get the HTML form element of the field of the current row in the List
page.

Table-Specific -> Multi-Update Page

Client Script The script will be placed after the header.

Startup Script The script will be placed before the footer.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own custom
validation. The form object can be accessed by the parameter fobj. Return false if the form values
do not pass your validation.

Table-Specific -> Report Page

Client Script The script will be placed after the header.

Startup Script The script will be placed before the footer.

Table-Specific -> Search Page

Client Script The script will be placed after the header.

Startup Script The script will be placed before the footer.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own custom
validation. The form object can be accessed by the parameter fobj. Return false if the form values
do not pass your validation.

Table-Specific -> View Page

Client Script The script will be placed after the header.

Startup Script The script will be placed before the footer.

Other -> Login Page

Client Script The script will be placed after the header.

Startup Script The script will be placed before the footer.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own custom
validation. The form object can be accessed by the parameter fobj. Return false if the form values
do not pass your validation.
Other -> Registration Page

Client Script The script will be placed after the header.

Startup Script The script will be placed before the footer.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own custom
validation. The form object can be accessed by the parameter fobj. Return false if the form values
do not pass your validation.

Other -> Change Password Page

Client Script The script will be placed after the header.

Startup Script The script will be placed before the footer.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own custom
validation. The form object can be accessed by the parameter fobj. Return false if the form values
do not pass your validation.

Other -> Password Recovery Page

Client Script The script will be placed after the header.

Startup Script The script will be placed before the footer.

Form_CustomValidate This event is fired after the normal form validation. You can use this event to do your own custom
validation. The form object can be accessed by the parameter fobj. Return false if the form values
do not pass your validation.

Note It is recommended that you develop your server event and client scripts in the generated script so you can edit and
test it immediately. When you finish your custom script, copy it to PHPMaker custom script editor and save it.

Objects in PHPMaker Generated Code


The following objects are available in the generated code and you can use them in the Server Events to add more power to
the code. The most important objects are:
Page Object
The Page object is generated for most pages. You can access the object properties using the -> notation (e.g.
CurrentPage()->PageID). The page class inherits from the table class generated for each table. The methods and properties
of the page class varies with page, for the complete list of methods and properties, please refer to the generated page
class in the generated scripts and the class "c<Table>" (e.g. cCars) in the generated file "<Table>info.php".
Field Object
A <Field> object is generated for each field in a table. For example, the "Trademark" object is generated for the
"Trademark" field in the "Cars" table. You can access the object properties using the -> notation (e.g. CurrentPage()-
>Trademark->CurrentValue). For the complete list of methods and properties, please refer to the class "cField" in the
generated file "phpfn*.php".
Security Object
The Security object is used to store the current Advanced Security settings. Please refer to the class "cAdvancedSecurity"
in the generated file "phpfn*.php" for the complete list of methods and properties.
Email Object
The Email object contains the required information of the email to be sent, the instance of the object will be passed to the
Email_Sending events as argument and let you modify the email. Please refer to the class "cEmail" in the generated file
"phpfn*.php" for the complete list of methods and properties.
Menu Object
The Menu object contains all information of a menu, the instance of the menu will be passed to the Menu_Rendering
events as argument and let you work with the menu. Please refer to the class "cMenu" in the generated file
"ewshared*.php" for the complete list of methods and properties.
MenuItem Object
The MenuItem object contains all information of the menu item, the instance of the menu item will be passed to the
MenuItem_Adding events as argument and let you work with the menu item. Please refer to the class "cMenuItem" in the
generated file "ewshared*.php" for the complete list of methods and properties.
ListOpions Object
The ListOptions object contains all information of the non data columns in the main table of the List page. Please refer to
the class "cListOptions" in the generated file "phpfn*.php" for the complete list of methods and properties.
ExportOpions Object
The ExportOptions object contains all information of the export links in the List page. It is also an instance of the class
"cListOptions". Please refer to the class "cListOptions" in the generated file "phpfn*.php" for the complete list of methods
and properties.
Language Object
The language Object lets you retrieve a phrase of the active language during runtime. The phrase can be retrieved in the
generated scripts using methods such as Phrase, TablePhrase and FieldPhrase. Please refer to the class "cLanguage" in
the generated file "ewshared*.php" for the complete list of methods and properties.
Breadcrumb Object
The Breadcrumb object contains all information of the breadcrumb at the top of page. Please refer to the class
"cBreadcrumb" in the generated file "phpfn*.php" for the complete list of methods and properties.
There are other objects in the generated code, please refer to the source code of the file "phpfn*.php" and "ewshared*.php"
in template or generated scripts.

Some Global Functions


The following are some useful global function available in the generated code for you to get information easier in server
events:
Function name Arguments Description Example
Conn - Get the global connection object $rs = Conn()->Execute("SELECT ..."); // execute
a SELECT statement and get recordset object
Security - Get the global security object if (Security()->CanEdit()) { // check if current user
has Edit permission for the current table (for use
with User Level Security
...your code...
}
Language - Get the global language object Language()->setPhrase("AddLink", "xxx"); //
change the wording for the "Add" link
CurrentUserName - Get current user name. $username = CurrentUserName();
CurrentUserID - For used with User ID Security (see $userid = CurrentUserID();
Security Settings). Get current User ID.
CurrentUserLevel - For used with User Level Security (see $levelid = CurrentUserLevel();
Security Settings). Get current user's User
Level ID (integer). (Note: NOT current
user's permission as integer.)
CurrentUserInfo fieldname For used with Advanced Security (see $email = CurrentUserInfo("email");
Security Settings). Get current user's info
from the user table. The argument is the
field name in the user table.
CurrentPageID - Get current page ID. A page ID identifies if (CurrentPageID() == "add") {
the page type, it can be "list", "view",
"add", "edit", "delete", "search", etc. ...your code...

}
CurrentPage - Get current page object. $rowindex = CurrentPage()->RowCnt;
CurrentTable - Get current page object. Alias of $value = CurrentTable()->MyField-
CurrentPage. >CurrentValue;
IsLoggedIn - For used with Advanced Security (see if (IsLoggedIn()) {
Security Settings). Get the login status of ...your code...
the current user. }
ew_Execute SQL Execute UPDATE, INSERT, or DELETE ew_Execute("UPDATE MyTable SET...
statements. WHERE...");
ew_ExecuteRow SQL Executes the query, and returns the first $row = ew_ExecuteRow("SELECT * FROM
row as an array. MyTable WHERE...");
ew_ExecuteScalar SQL Executes the query, and returns the first $value = ew_ExecuteScalar("SELECT MyField
column of the first row. FROM MyTable WHERE...");

There are many other useful functions in the generated code, please refer to the source code of the file "phpfn*.php" and
"ewshared*.php" in template or generated scripts.

You might also like