Hello,
I trying to add a field to my grid that will automatically contains the value of a concatened chain
The hidden field uname should contains concat(‘firstname’,’.’,’lastname’)
Could you help me with this?
Thanks,
Ced
$col = array();
$col[“title”] = _HSElname;
$col[“name”] = “hsetest_lastname”;
$col[“formoptions”] = array(“elmsuffix”=>'<font color=red> *</font>’);
$col[“width”] = “20”;
$col[“search”] = true;
$col[“editable”] = true;
$cols[] = $col;$col = array();
$col[“title”] = _HSEfname;
$col[“name”] = “hsetest_firstname”;
$col[“formoptions”] = array(“elmsuffix”=>'<font color=red> *</font>’);
$col[“width”] = “20”;
$col[“search”] = true;
$col[“editable”] = true;
$col[“editrules”] = array(“required”=>true);
$col[“sortable”] = true;
$col[“show”][“add”] = true;
$col[“show”][“list”] = true;
$cols[] = $col;$col = array();
$col[“title”] = _HSEUname;
$col[“name”] = “hsetest_uname”;
$col[“width”] = “20”;
$col[“search”] = false;
$col[“editable”] = false;
$col[“sortable”] = false;
$col[“show”][“add”] = false;
$col[“show”][“list”] = false;
$cols[] = $col;
Hi,
You can do it using callback (on_insert) function. You need not to include this hidden field on grid. For more details, refer: https://www.gridphp.com/docs/grid-events/
$e["on_insert"] = array("add_data", null, true); $g->set_events($e); function add_data($data) { $data["params"]["hsetest_uname"] = $data["params"]["hsetest_firstname"] . "." . $data["params"]["hsetest_lastname"]; }