This event will be called before closing database connection. Page_DataRendering
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
// 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.
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() {
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 = ">"; // 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.
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.