Page 1 of 1

Row Deleting event

Posted: Thu Aug 01, 2024 7:56 pm
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


Re: Row Deleting event

Posted: Thu Aug 01, 2024 10:59 pm
by mobhar

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