Hi,
I want to set a defaut value to a hidden column when editing a row. How can I do that (with the free version) ?
(I want to automatically set the column 'last_update' to set the time of the last update of a row).
Thanks
Hello,
The best option would be to use on_update callback and do your changes. But as you are using free, i can suggest a JS based alternate solution. You can make last_update field as non-editable. And pass it using JS code. Refer e.g below. Replace input field data with date() function, and rename mydata variable to your table field.
Q) How to post other form data with Grid add/edit form?
Add extra parameters while add/edit …you can add following event.
Here 'my_text_box' is html input field id, and it will be passed to php with name 'mydata'.
$opt["edit_options"]["onclickSubmit"] = "function(params, postdata) { postdata.mydata= jQuery('#my_text_box').val(); }";
$opt["add_options"]["onclickSubmit"] = "function(params, postdata) { postdata.mydata= jQuery('#my_text_box').val(); }";
…
$g->set_options($opt);