Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Table events

Is Record Editable

Scroll Prev Next More

Description

The IsRecordEditable event occurs after the AfterTableInit event. Use this event to implement custom edit permissions.

 

This event is executed once for each record on the List page as well as on the Edit page. This event is also called before the record is deleted.

Syntax

IsRecordEditable(values,isEditable)

Arguments

values

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

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

 

isEditable

1 if record is editable, 0 if not editable

Return value

True - the record is editable.

 

False - the record is not editable.

Applies to pages

List, Edit.

Example 1

Disable editing of data in a certain table on weekends:

 

if Weekday(Now())==1 or Weekday(Now())==7 then
  IsRecordEditable=false
else
  IsRecordEditable=true
end if

Example 2

Enable editing of only the records with odd IDs (1,3,5 ...):

 

if values("ID") mod 2 = 1 then
  IsRecordEditable=false
else
  IsRecordEditable=true
end if

See also:

About Security API

Get Table Permissions

User group permissions

Choose Pages Screen

Event: After table initialized

"Edit as" settings

Audit and record locking

SQL query screen

About SQLQuery class