Set defaut value to hiddent column

QuestionsSet defaut value to hiddent column
Bzh asked 11 years ago

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

1 Answers
Abu Ghufran answered 11 years ago

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);

Your Answer

13 + 7 =

Login with your Social Id:

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 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

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

Let us improve this post!

Tell us how we can improve this post?