Dropdown and autocomplete

QuestionsDropdown and autocomplete
Gustavo Lazaro asked 7 years ago

Hi Abu. Mix some dropdown and autocomplete on line 202, but it would not be working. Do you have any idea what it might be? The diagnostico field depends on the chosen value in patologia. Thank you

https://pastebin.com/LQsC2Ggc

3 Answers
Abu Ghufran answered 7 years ago

I am unable to understand the issue.
Please send screenshot of expected result. Also send sql dump for testing.

Gustavo Ageitos answered 7 years ago

Dear Abu. I send you a summary of the application with a dump of the tables. I tell you that the gen_pathology table has 2434 records and the gen_diagnostic table has 29435. I think that's why I do not use dropdown like dropdown-country-city.php. When I choose a pathology, the diagnostic autocomplete must be armed only with the diagnoses of the chosen pathology

https://pastebin.com/17DiEQxd

Abu Ghufran answered 7 years ago

To make second autocomplete dependent on pathology, you just need to set in sql: WHERE codPatologia = '{codPatologia}'

"sql"=>"SELECT codDiagnostico AS k, diagnostico AS v FROM gen_diagnostico WHERE codPatologia = '{codPatologia}' ORDER BY diagnostico"

$col = array();
$col["title"] = "Diagnostico";
$col["name"] = "diagnostico";
$col["editable"] = true;
$col["width"] = "150";
$col["editoptions"] = array("size"=>90, "maxlength" => "90");
$col["formatter"] = "autocomplete"; // autocomplete
$col["formatoptions"] = array("sql"=>"SELECT codDiagnostico AS k, diagnostico AS v FROM gen_diagnostico WHERE codPatologia = '{codPatologia}' ORDER BY diagnostico", "search_on"=>"diagnostico", "update_field"=>"codDiagnostico");
$cols[] = $col;

Working code: https://pastebin.com/5a7BgGDR

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?