checkbox checked or select option with the value of another field in the same record

Questionscheckbox checked or select option with the value of another field in the same record
Francisco José Segura Noya asked 8 years ago

Hello, Abu.

I have to create a column with a checkbox field (at least select) to enter in this column the value of another field in the same record.

I studied the dropdown fields of the demo:
$ Str = $ g-> get_dropdown_values ??("select distinct client_id as k, v name as from clients");
$ Col ["editoptions"] = array ("value" => ";". $ Str);

And I adapted to my situation:
for ( $i = 0 ; $i < 10 ; $i ++) {
$col = array();
$col["title"] = "$mes[$i]";
$col["name"] = "justifica_0$i";
$col["width"] = "40";
$col["align"] = "center";
$col["search"] = false;
$col["editable"] = true;
$col["edittype"] = "select"; // render as select
# fetch data from database, with alias k for key, v for value
$str = $g->get_dropdown_values("
SELECT
distinct ROUND((h.ayuda_conc/10),0) as k,
g.pae_gestion,
g.id_gestion,
h.n_pae,
h.ayuda_conc,
ROUND((h.ayuda_conc/10),0) as v

FROM hijos_ayudas h
INNER JOIN
gestion g
ON h.n_pae = g.pae_gestion
WHERE g.id_gestion = '{id_gestion}'

");
$col["editoptions"] = array("value"=>":;".$str);
//$col["formatter"] = "select"; // display label, not value
$cols[] = $col;
);

But the select field displays the option: "undefined"

You can see the complete code in: http://pastebin.com/WSvGw8fS

Please, I need your help,
Thank you

1 Answers
Abu Ghufran answered 8 years ago

currently get_dropdown_values does not support {id_gestion} placeholder.
You can remove the WHERE condition from this function and add onload-sql option and set the placeholder in that sql.

Refer this code: http://pastebin.com/6pdUdv43

Your Answer

12 + 10 =

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?