PHPGrid Event not working

QuestionsPHPGrid Event not working
Rankaj asked 4 years ago


I am using below phpgrid events for server validation but its not working.Can you please tell how to check event handler for 'on_insert' & 'on_delete'.

$e["on_insert"] = array("add_client", null, true);


3 Answers
Rankaj answered 4 years ago

Hello Abu,

Simple 'phpgrid_error' message is also not displaying for 'on_insert'/ 'on_delete' events.

What can be the mistake here below in code.I also changed the last param to false/true for both cases.But didn't work.

$e["on_insert"] = array("add_client", null, false);
$e["on_delete"] = array("del_client", null, false);
function add_client($data)
phpgrid_error("This is test function for insert");


function on_delete($data)
phpgrid_error("This is test function for delete");



Abu Ghufran answered 4 years ago

Refer this code:

$e["on_insert"] = array("add_client", null, false);

If you pass last argument as true, functions will act as a filter and insert/update in `->table` will be performed by grid after your function. If last argument is set to false, only your function handler will be executed.

Anand answered 2 months ago

Hi Abu,

I tried this manual insert in cakephp 3 when submit record its showing record added message but no record will be inserted. also when submit the record submit not calling the record add function.



$e[“on_insert”] = array(“add_record”, null, false);
$e[“on_update”] = array(“update_by”, null, false);

//$e[“on_update”] = array(“update_by”, null, false);
//$e[“on_insert”] = array(“add_record”, null, false);


function add_record($data)
global $g;
$created_by = $this->Auth->user(‘id’);
$created_date = “‘”.date(‘Y-m-d H:i:s’).”‘”;


Your Answer

0 + 14 =

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!