Hi,
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);
$grid->set_events($e);
Thanks
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");
}
ThankS
Refer this code: http://phpgrid.org/demo/demos/editing/server-validation.phps
$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.
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.
$g->set_columns($cols);
$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);
//phpgrid_error($e[“on_insert”]);
$g->set_events($e);
//phpgrid_error($data);
function add_record($data)
{
//phpgrid_error($data);
global $g;
$created_by = $this->Auth->user(‘id’);
$created_date = “‘”.date(‘Y-m-d H:i:s’).”‘”;
Thanks