CodeCharge Studio

DeleteAllowed Run-Time Property (PHP)

Applies to

Record Form, EditableGrid Form






object->DeleteAllowed [= value]


This property contains boolean flag that if set, prevents record deletion operation from executing. This property is set automatically by the Record form to True or False if the access to the form is restricted by setting its “Restricted” property to “Yes” in the IDE. If “Restricted” is set to “No”, then DeleteAllowed property is always True unless modified in the Before Delete event. The value of this property can be changed in the After Initialize event of the Page.

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


The following example shows how to prevent a logged in user from deleting an item that does not belong to him/her. Additionally, the form displays an error message.
global $items;
if ($items->user_id->GetValue() != CCGetUserID())
  $items->DeleteAllowed = false;
  $items->Errors->addError("You are not allowed to delete this item.");
where $items is the name of the form.

See also

InsertAllowed Property
UpdateAllowed Property
ReadAllowed Property

On-line, printable versions and updates