Auto Search field from Clients list in lightbox

Hi, in my lightbox, i have right now a dropdown witch show a client list from mysql database. But now, I have something like 400 customers in that dropdown. Is is possible to have an auto search field that will search in my client list. So in other words, I would like to have an empty box in witch I can type the customer’s name and then it will find it for me and I can select it instead of having a simple dropdown list of 300 customeers
Her’s my code below
Tks
Seby

<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title></title>
html, body{ margin:0px; padding:0px; height:100%; overflow:hidden; }
 
 
 

You can check
samples\02_customization\18_combo_select_from_db.html

It shows how dhtmlxCombo can be used as editor in lightbox, it will load suggestion list of possible values as you are typing the text

Hi Stanislav, tks for the answer… I tried but could not insert it in my code. Could you gie me an example please?

Seby

Add next includes on the page

[code]

<link rel="stylesheet" type="text/css" href="../../../dhtmlxcombo/codebase/dhtmlxcombo.css">
<script  src="../../../dhtmlxcombo/codebase/dhtmlxcommon.js"></script>
<script  src="../../../dhtmlxcombo/codebase/dhtmlxcombo.js"></script>

[/code]
In your code, replace

{name:"clients", height:20, map_to:"client_id", type:"select", options:scheduler.serverList("clients")},

with

{ name:"clients", map_to:"client_id", type:"combo", image_path: "../../../dhtmlxcombo/codebase/imgs/", filtering: true, script_path: "php/complete.php", cache: true },

And in php/complete.php you will have something like

[code]<?php
require_once("…/config.php");
$res=mysql_connect($mysql_server,$mysql_user,$mysql_pass);
mysql_select_db($mysql_db);

require("…/…/codebase/combo_connector.php");
$combo = new ComboConnector($res);
$combo->render_table(“clients”,“id”,“name”);
?> [/code]

Hi Stanislav, I tried with my developper to apply the code… See below. But now the problem we have is this…
The Combo Select Edit Not working with scheduler. I have used client id as value and client name as text. When I save with the client name, it’s working, but when I edit the same record I just saved, The client field show only the Client id . whne i save it again then, it get empty. can you help me to fix it please?
tks
Seby

include (’…/…/common/config.php’);
$res=mysql_connect($server,$user,$pass);
mysql_select_db($db_name);
require("…/…/…/codebase/combo_connector.php");
$combo = new ComboConnector($res);
$combo->render_table(“clients”,“id”,“full_name”);

Here’s the image when I create and save the Event

And Here’s the same one when I Edit, I see only the Client ID

tks Again
Seby

Yep, I can reconstruct the issue, there is problem with “combo” form block
It will take some time, I will provide an updated sample is one-two days.

Ok tks,
Seby

Hi again Stanislav, I was just wondering if you’ve found a solution for the problem.
Thank you very much for your help
Seby

Hello again Sir, sorry to bother you. Have you found a solution for my problem?
tks
seby

Unfortunately this one takes more time then expected.

Combo as it used now in scheduler, doesn’t suite very well for above scenario. ( it loads data only after lightbox opening and can convert value to label after that ). We will provide fix, but I’m not sure when it will be available :frowning:

Hi,

I realized I also experience such issue with dhtmlxCombo v3.0.

Please post any updates regarding this.

Many thanks and cheers!

Hi,

Want to share a hack on how to go about this issue, as seen below. The code is added into the “onLightbox” event:

                                // since no fixed id to identify, I used the css class
                                // but best if an id for the combobox is present
                                get_account_code_of = $('.dhx_combo_input').val();

                                // connects via AJAX to the server-side to get the 
                                // corresponding text value of the numeric code
                                post_url = base_url+"/connector/";
                                $.ajax({
                                        url: post_url,
                                        type: "GET",
                                        data: ({'get_account_code_of': get_account_code_of}),
                                        success: function(data)
                                        {
                                                // substitute the text code to the numeric code
                                                $('.dhx_combo_input').val(data);
                                        }
                                });

Cheers!

I guess my hack isn’t really a solution after all :frowning:

I believe once we know what’s the exact combo object created from the following

scheduler.config.lightbox.sections=[
                        {name:"description", height:100, map_to:"text", type:"textarea" , focus:true},
                        {name:"loc", map_to:"clinic_account_idx", type:"combo", image_path: dhtmlx_combobox_path+"/imgs/", filtering: true, script_path: base_url+"/connector/?get_accounts=", cache: false },
                ]

… we can issue the obj.loadXML(url) again which may be the one calling the GET request i see in firebug …

Any updates guys?

Cheers!

Hi All!

Got the true hack this time. Since Stanislav has been honest about the fix for this issue may need much time, I can’t afford to wait, so I deviced a hack for it.

First, I observed that the onClick event in the combobox is always triggered and a GET method is triggered each time,

http://localhost/medrecordsys/connector/?get_accounts=&pos=0&mask=SACREDHEART&a_dhx_rSeed=1327144369891

… which in effect returns the XML that contains the exact id of the chosen text searched.

Second, this GET method, if not done prior to saving the Lightbox form, will cause the data in the combobox to save blank data to the db once saving the Lightbox form is deliberately done.

Though I suspect an internal mechanism to fetch and reload the XML data is done every time onClick event is triggered, I then used

$('.dhx_combo_input').click();

to programmatically trigger that mechanism. And so far, for several tests, everything works fine, either dragging the event or manually changing the dates works perfectly.

Hope this helps anyone in need of it.

Cheers!

Hi Stanislav, i’m still waiting for a solution. Is there something coming up soon?
tks
Seby

Hi again Stanislav, it’s been a while since your last answer… i’m still waiting for a little bit of help. Would it be possible to have an answer please?.
Thank you very much for your help.
Seby

Hi Sir, would it be possible to have an answer please of what are the progress on the bug in the application?
tks
seby

Hello,

This issue is not resolved yet.
I am sorry for the inconvenience this have caused.
It is in work though and as soon as update is ready - it will be posted.

Kind regards,
Ilya

I have the same problem.Could you find a solution Stanislav.