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

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

Important Note:

  1. You should never change this field unless you are absolutely sure that this field is unique. Otherwise a particular record cannot be located and unexpected results may occur.
  2. Composite key is supported, and primary key is uneditable in the edit page.
Page No.

Page number of the field. By default all the fields are in page 1 and Multi-Page is disabled. If you set any page number to larger than 1, Multi-Page feature will be enabled automatically.

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.

Note: Multi-Page is supported for Add/Edit/View/Search pages, you can enable/disable the feature for each page. Page labels are also supported. See Table Setup.

 

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)

    MyAutoValueFunction1,MyAutoValueFunction2

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

Custom field order by drag-and-drop

 

 

List Page

Properties

List Show field in list page
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 allowed 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:

formatted text

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
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 attribite 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 (to be ended with 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 recognised 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->MyField->CurrentValue}&id=

This example assumes that MyField is integer so you do not need to URL-encode the field value.

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. This example assumes that Field2 is string so you should URL-encode the field value.

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 WILL OVERRIDE ALL ABOVE VIEW TAG SETTINGS. You are completely on your own to display the field value with your own code. Intermediate knowledge in PHP, HTML and JavaScript is required. Use this setting carefully.

Custom View Tag is HTML, if you want to embed PHP code, you need to use "<?php" and "?>", if you want to use JavaScript, you need to 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 orginal code by regular expression:

<div id="my_unique_id"></div>
<script type="text/javascript">
document.getElementById("my_unique_id").innerHTML = document.getElementById("orig_MyTable_MyField").innerHTML.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.

Image

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: Note that 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
Title

Title to be placed in title attribute of Edit Tag. (see section below)

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

Auto-Suggest - 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 database, PHPMaker considers enum('Y','N') and enum('1','0') as boolean fields. For Oracle database, 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.

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

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.

Upload folder - the 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 Setup).

Notes:

  1. Unlike the global upload folder setting (which is a constant and must be a string without double quotes), this field specific 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->CurrentValue. However, you must be very carefull 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 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.

Resize image - Optionally resize the image to resize width and/or height.

Resize width - the width of the resized image

Resize height - the height of the resized image

Note: Note that 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.

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:

Lookup Table tag setup

 

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($this->AField->CurrentValue) <> "") ? "`ALookupTableField` = " . $this->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 does not need to be escaped (e.g. does not contain single quotes),

    (strval($this->AField->CurrentValue) <> "") ? "`ALookupTableField` = '{$this->AField->CurrentValue}'" : ""

    c. if the value needs to be escaped,

    (strval($this->AField->CurrentValue) <> "") ? "`ALookupTableField` = " . ew_QuotedValue($this->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($this->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, the filtering behavior at runtime (in the browser) will be as follows:

a. If only Parent field #1 has selected value, the records will be filtered by:

Filter field #1 value = Parent field #1 selected value

b. If only Parent field #2 has selected value, the records will be filtered by:

Filter field #2 value = Parent field #2 selected value

c. If 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)

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, newer version of browsers such as IE6+/FF1+ is required.

  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.

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 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 requires IE5+/FF1+. It 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
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

Note: 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. PHPMaker supports "BETWEEN" search operator. If you want to use it, 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.)

 

 

 

 
 ©2002-2012 e.World Technology Ltd. All rights reserved.