Checkbox fill a field with the value of another field

QuestionsCheckbox fill a field with the value of another field
Francisco José Segura Noya asked 8 years ago

Hello, Abu.
1. I want to create a checkbox: When selected, fill the field with the value of another field in the same table, when not selected leave it blank.

2- In Edit mode excel, my checkboxs not respond to click. This is my code:
$col = array();
$col["title"] = "mes";
$col["name"] = "justifica";
$col["width"] = "50";
$col["align"] = "center";
$col["search"] = false;
$col["editable"] = true;
$col["edittype"] = "checkbox"; // render as checkbox
$col["editoptions"] = array("value"=>"1:0"); // with these values "checked_value:unchecked_value"
$col["formatter"] = "checkbox";
$cols[] = $col;

You can help me? Thank you

1 Answers
Abu Ghufran answered 8 years ago

1. You can set onclick event of check and fill the field with jquery code.
$col["editoptions"]["onclick"] = "function(){ … }";

Use firebug or debugger F12, to find the element ID and use jquery code to fill other field.

2. You can test this code by saving it in demos/misc/example-all.php:
http://pastebin.com/2bfbgsTX

In excel mode, when you click a cell, it comes in edit mode. And when either press enter or select other cell, the previous one is saved in db.

Your Answer

1 + 16 =

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?