CodeCharge Studio

Update Allowed Run-Time Property (PHP)

Applies to

Record Form, EditableGrid Form






object->UpdateAllowed [= value]


This property contains boolean flag that if set, prevents record update operation from executing. This property is set automatically to False by the Record form 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 UpdateAllowed property is always True unless modified in the Before Update 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 Update button.


The following example shows how to prevent a logged in user from updating 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->UpdateAllowed = false;
  $items->Errors->addError("You are not allowed to edit this item.");
where $items is the name of the form.

See also

InsertAllowed Property
DeleteAllowed Property
ReadAllowed Property

On-line, printable versions and updates