Hello
I want to read the user name from the session, and then put a function in one of the columns at the time of calling the add function.
1 Answers
To set session value in some field while showing add form, you can set it as default value. e.g.
$col[“name”] = “userid”;
$col[“editoptions”][“defaultValue”] = $_SESSION[“userid”];
and you can make such field hidden as well, $col[“hidden”] = true;
If you want to set it after postback, you can use on_insert event and set it there.
$e[“on_insert”] = array(“add_client”, null, true);
$g->set_events($e);
function add_client(&$data) {
$data[“params”][“userid”] = $_SESSION[“userid”];
}
Refer http://phpgrid.org/docs/grid-events/ and demo code for help.
Your Answer