Row Deleting event

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
mpol_ch
User
Posts: 896
Location: Switzerland

Row Deleting event

Post by mpol_ch »

Hi,
I am using the following code to check the record before deleting it.
When the condition is "false" then it is freezing.
No message and no work for "cancel" button.
any idea?

   // Row Deleting event
   function Row_Deleting(&$rs)
   {
       // Check if the current user is not an admin and not the owner of the record
       if (CurrentUserLevel() != -1 && CurrentUserID() != $rs["Code"]) {
           $this->setFailureMessage("Sorry you are not the owner.");
           return false; // Cancel the delete operation
       } else {
           return true; // Allow the delete operation
       }
   }

mpol_ch


mobhar
User
Posts: 11905

Post by mobhar »

You need to evaluate the value of $rs["Code"], make sure your if condition are met.


Post Reply