Description
The BeforeEdit event is executed before the data record is updated in the database. It works in all edit modes: Inline Edit, Regular Edit and an Edit page in a popup.
Syntax
public XVar BeforeEdit(dynamic values, dynamic where, dynamic oldvalues, dynamic keys, 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 array of values to be written to the database. To access a specific field value, use values["FieldName"]. Note: in case of Update Selected values array will only contain those fields that user have selected to update.
where
WHERE clause that points to the record to be copied. Example: ID=19.
oldvalues
an array with existing field values. To access a specific column value, use oldvalues["FieldName"]
keys
an array of key column values that point to the edited record. To access specific key column, use keys["KeyFieldName"].
message
message to be displayed to the end user if false is returned and edit is canceled.
inline
true for the Inline Edit or Edit in popup, false otherwise.
pageObject
an object representing the current page. For more information, see RunnerPage class.
Return value
true: the changes will be saved.
false: the changes will not saved.
Applies to pages
Edit, Inline Edit, Update Selected
Note: In case of Update Selected page
Recommended sample events:
•Send an email with updated fields only
•Check if start date is ealier than end date
See also:
•How to control Inline Add/Edit functionality from script
•Javascript API: InlineRow object