CodeCharge Studio

InsertAllowed Run-Time Property (PHP)

Applies to

Record Form, EditableGrid Form

Type

boolean

Access

read/write

Syntax

object->InsertAllowed [= value]

Description

This property contains a boolean flag that if true, allows insert database operations. This property should be changed in Page AfterInitialize, Form Before Insert (or On Validate) Event to prevent a form from creating a new record in the database.

Note: Setting this property to False in the On Validate event or the Page's After Initialize event results in hiding of the Insert button.

Examples

The following example shows how to prevent a user from inserting an item into database if the provided email address can be found in emails table of the database. Additionally, the form displays an error message.
global $items;
if (CCDLookUp("email_address","emails","email_address="
. $items->DataSource->ToSQL($items->email_address->GetValue()),$items->DataSource))
{
  $items->InsertAllowed = false;
  $items->Errors->addError("Provide another email adress.");
}
where $items is the name of the form.

See also

UpdateAllowed Property
DeleteAllowed Property
ReadAllowed Property


On-line, printable versions and updates