I would like to know if there is a function can use to fetch data from my database and put it in a column while I'am adding a new record.
I'm adding a new record I picked a product and I have a Price List that relates the product to his price so I want to pick from the dropdown a product and place in the column Price the price that I found by searching in the Price List while I'am adding the record.
I use the event ["on_insert"] and ["on_update"] for some grids but for this one I want something like ["on_adding"] or ["on_newrecord"]
Please refer demos/appearance/dropdown-callback.php
It fills textbox after dropdown selection.
Thanks Abu, I have just another question.
I'm passing the rowid and the client_id of the master grid to the detail grid. I need to use these 2 values to make a function that searches in my database for the price of the product because I have more than one price list, example: Price List 1, Price List 2 and Price List 3, so each client may only have one price list selected but I have 3 prices of the same product.
$id = intval($_GET["rowid"]);
$client = intval($_GET["idClientes"]);
$idListas_Precios = intval(Carga_Id($client));
Carga_Id is a function that I created to get the Id of the Price List that the client has. The problem is that I only get the values of the rowid and idClientes columns when I use the [on_insert] and [on_update] events. Is there any way to get this values without using these 2 functions.
$str = $g->get_dropdown_values("select idProductos as k, descripcion as v from productos");
$col["editoptions"] = array(
"onchange" => array(
"sql"=>"SELECT precio FROM precios WHERE idListas_Precios = $idListas_Precios",
"callback" => "fill_form" )
I need to update the price column when I'm adding the record, it is a lot more helpful for the user to know the price of the product when he picks it from the dropdown not when he already add the record. I hope I made my self clear.
It should work with dropdown and callback function.
Please tell exact issue you are facing in it. Screenshot + complete code would help.
How useful was this discussion?
Click on a star to rate it!
Average rating / 5. Vote count:
We are sorry that this post was not useful for you!
Let us improve this post!
Thanks for your feedback!