autocomplete.php

Questionsautocomplete.php
Chao Shun Jenq asked 11 years ago

Hi,
autocomplete is a good function.

but in the autocomplete.php,
$col["formatoptions"] = array("sql"=>"SELECT client_id as k, name as v FROM clients","search_on"=>"name","update_field" => "client_id");

when we set the edittype of client_id to "select" (as below)

$col["name"]= "client_id";
$col["edittype"]= "select";

the "update_field" (client_id) don't work.

may i have a "callback" function or fix it?

or any suggestion?

Rgds,

5 Answers
Abu Ghufran answered 11 years ago

The client_id field is hidden field in autocomplete, and it is required for autocomplete function.
If you wish to have dropdown based selection, and fill some value on its behalf, you can refer demos/appearence/dropdown-callback.php in updated build.

Chao Shun Jenq answered 11 years ago

Hi,

my demand is:

I assume the database of clients have 10 thousands records.

When I input the data of the invheader , I wish type the customer's name in the cust_name field (virtual column) first,the next field (client_id, cann't be hidden) can according to cust_name to search and return a dropdown menu from clients database.
(Because I cann't download all of the data from clients to make a dropdown menu,it's too large.)

This function look like combine the "dropdown" and "autocomplete".

Rgds,

Abu Ghufran answered 11 years ago

Hello,

Please explain little more scenario for solution.

Why it is required to have customer name in dropdown. Currently it is in textbox with autocomplete (where as client-id is secretly set for postback operations). Do you want to restrict the customer name to dropdown instead of textbox?

Something like http://harvesthq.github.io/chosen/ ?

an answered 10 years ago

so very strange, I changed name of client_id field to another cl_id in database for example. The autocomple.php demos changed client_id to cl_id too. The exam show autocomplete but cl_id field show the name of client not id. When click reload button the record has been changed before disappeared. So please explain this case. Thanks a lot

Abu Ghufran answered 10 years ago

Query is little unclear.
Please share the code and output screenshots (current / desired).

Your Answer

7 + 17 =

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?