Please enable JavaScript to view this site.

Navigation: Using PHPRunner

Event editor

Scroll Prev Next More

 

Events are fragments of PHP or JavaScript code that are executed automatically when certain conditions are met, for instance: a record was added to the database, or the user opened the List page. You can use sample event code snippets or write the code on your own.

 

Here are a few examples of events:

 

send an email containing the data from a new record or showing changes to an existing record;

save new data in another table;

check if a specific record exists;

limit the number of records a user can add.

 

There are two types of events: Global and Table events. Global events can be used with any table/view. Table events work with a specific table/view.

Event Editor toolbar description

Button

Description

add_action_bt

Allows adding one of the predefined actions.

erase_bt

Erases the event code.

undo_bt

Reverses the last operation.

redo_bt

Reverses the last "Undo" operation.

check_syntax_bt

Syntax error indicator. Will display a check mark if the code is correct and stop sign otherwise.

search_bt

Opens the Search and Replace in the current event dialog.

find_all_bt

Opens the Find All dialog. Searches and replaces the code across all events.

cody_button

Opens AI assistant panel.

Working with events

To add an event:

1. Go to the Events screen.

 

2. Select an event from the tree in the left pane. Events with the code will be shown in bold. To filter the events by name, use the text field above the tree in the left pane.

 

Each event has a collapsible hint with the event description, syntax, and a list of parameters. To hide the hint, click the 'Description' link.

events

 

Note: you can change the font size on the Event Editor and Style Editor screens. Hold CTRL and scroll the mouse wheel to do so.

 

3. Add the code or click the add_action_bt button to open the predefined actions popup.

 

To learn more, see these articles:

Sample events - examples of commonly used events with code snippets.

Common parameters you can use in the events.

 

4. Choose one of the predefined actions to add a code snippet to the event.

send_simple_email_select_action

 

5. Modify the code snippet replacing the sample values with the actual ones.

event_inserted_action

 

 

Note: you can add more than one predefined action to an event.

 

To edit the event, select an event and modify the code. To delete the event, select an event and click the erase_bt button.

Intellisense

Intellisense is a convenient way to access the descriptions and variables of the functions. The Event Editor recognizes the functions and variables and shows the function description or the list of available variables to choose from in a popup.

 

Here are a few examples:

Database API

intellisense_dal

PHP functions

intellisense__phpcalltips

JavaScript API functions

intellisense_jscontrols

Field names

intellisense_values

Custom_function.js

You can find a custom_function.js file in the event tree in the left pane. This file is loaded on each page in the generated application.

 

Custom_function.js is best suited for utility functions. For example, you can add an OrderTotal calculation to this file to Show order total on the Edit page as the details table is updated.

 

Here is how the cuctom_function.js window looks like on the Events screen:

events_custom_function_js

See also:

Predefined actions

Sample events

Global events

Table events

Page life cycle overview

Common event parameters

Field events

Tri-part events

Cody: AI assistant

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software