Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Table events > Add page

Events.Before record added

Scroll Prev Next More

Description

The BeforeAdd event is executed before the record is physically added to the database. It works in all add modes: Inline Add, Regular Add and an Add page in popup.

Syntax

public XVar BeforeAdd(dynamic values, dynamic sqlValues, ref dynamic message, dynamic inline, dynamic pageObject)

Arguments

Note: Field names are case-sensitive. If the field name is PlayerId, you should use values["PlayerId"]. Note that values["playerid"] or values["PlayerID"] will not work.

 

Note: If the field was assigned an alias in the SQL query, then the values array will get the alias instead of the field name from the database.

E.g., if you have an SQL query SELECT salesrep_id AS Inv_Salesrep ..., you should use values["Inv_Salesrep"].

 

values

an list of values to be written to the database. To access a specific field value, use values["FieldName"]

sqlValues

You can specify field values here exactly as they will be inserted into the SQL query.

For example, to insert current server time into field LAST_MODIFIED in MySQL use the following:

sqlValues["LAST_MODIFIED"] = "now()";

 

message

message to display to the end user in case if you return false.

inline

true for the Inline Add or Add in popup, false for the standalone Add page.

pageObject

an object representing the current page. For more information, see RunnerPage class.

Return value

True: continue adding the record.

 

False: the record would not be added.

Applies to pages

Add, Inline Add.

Recommended  sample events:

•Add custom field to form

•Limit number of records users can add

•Select multiple values from checkboxes or a list field and have them appear as individual database entries

•Update multiple tables

•Send mass email to al users

•Rename uploaded files

•Speed up data entry using events

See also:

•How to control Inline Add/Edit functionality from script

•Javascript API: InlineRow object

•After record added

•Choose pages screen

•About SQLQuery class

•About SQLQuery screen

•Additional WHERE tabs