update other field on update

Questionsupdate other field on update
Cedric asked 5 years ago

Hello,

I have a field called weight, and when this one is updated with value 0 I would like to update the field called status

Is this possible in inline edit?

Thanks for you help

6 Answers
Cedric answered 5 years ago

Ok I found a way with running a sql update, on the event on_update, but the value is then reset by the end of the grid script. I know I can use the last param to false, but this will prevent updating the status field.

How can I update the value of the field within the form?

Abu Ghufran Staff answered 5 years ago

Refer this faq: Uses onblur event to update form fields.

http://www.phpgrid.org/faqs/#80

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Cedric answered 5 years ago

ok , I am progressing.

What if the field to update is a select ?

how do I pickup the correct value EpuiseĀ  ?

$col = array();
$col[“title”] = “Status”;
$col[“name”] = “Sa_Status”;
$col[“width”] = “40”;
$col[“editable”] = true;
$col[“edittype”] = “select”;
$col[“editoptions”] = array(“value” => “:;Dispo:Dispo;Emprunte:Emprunte;Epuise:Epuise”);
$col[“stype”] = “select”;
$col[“searchoptions”] = array(“value” => “:;Dispo:Dispo;Emprunte:Emprunte;Epuise:Epuise”);
$col[“formatter”] = “select”;
$cols[] = $col;

Abu answered 5 years ago

Updated FAQ to enable select dropdown as well. I just removed ‘input’ for jquery selector and it will search all html tags now.

https://www.phpgrid.org/faqs/#80

Cedric answered 5 years ago

Still does not work.

I removed the input but the Select box is still not updated.

Abu answered 5 years ago

Please share all related code for review.

Your Answer

14 + 5 =

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?