In a record form, clicking
on the Insert, Update or Delete buttons causes the corresponding action to be
executed against the database, provided that all validation checks for the submitted
values caused no errors. However, there sometimes arises the need to prevent
the insert, update or delete actions from being performed based on a condition
that is determined dynamically. For instance, if certain users should not be
able to update a record, you can check the identity of the user and disable
the update action if they try to update the record. The code to do this is of
the following nature in ASP:
'To prevent
an insert action from proceeding
FormName.InsertAllowed = false
'To prevent
an update action from proceeding
FormName.UpdateAllowed = false
'To prevent
a delete action from proceeding
FormName.DeleteAllowed = false
and in PHP the code would be:
'To
prevent an insert action from proceeding
global $FormName;
$FormName->InsertAllowed = false;
'To
prevent an update action from proceeding
global $FormName;
$FormName->UpdateAllowed = false;
'To
prevent a delete action from proceeding
global $FormName
$FormName->DeleteAllowed = false;
In the above code, FormName
should be replaced with the actual name of the record form. |