Welcome Guest, Not a member yet? Register   Sign In
jQuery AJAX autocomplete with CodeIgniter
#31

[eluser]rwzhao[/eluser]
[quote author="naren_nag" date="1243425384"]Honestly, this has me totally stumped. Would you mind emailing the models, views and controllers to me where you're trying to implement this.

Autocomplete is working for me on IE7 as well as IE8 so I really can't figure it out.

cheers,

Nag[/quote]

Here is what I get from I.E. error message:

Message: Expected identifier, string or number
Line: 548
Char: 2
Code: 0
URI: http://js/jquery.autocomplete.js

Will it help?
#32

[eluser]rwzhao[/eluser]
[quote author="rwzhao" date="1243763444"][quote author="naren_nag" date="1243425384"]Honestly, this has me totally stumped. Would you mind emailing the models, views and controllers to me where you're trying to implement this.

Autocomplete is working for me on IE7 as well as IE8 so I really can't figure it out.

cheers,

Nag[/quote]

Here is what I get from I.E. error message:

Message: Expected identifier, string or number
Line: 548
Char: 2
Code: 0
URI: http://js/jquery.autocomplete.js

Will it help?[/quote]

It works in I.E. after I put the following at the top of the html view:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

But the dropdown is long with blank at the top and serached result at the bottom. I am glad at least that I get it working in I.E.
#33

[eluser]naren_nag[/eluser]
[quote author="rwzhao" date="1244425735"]

It works in I.E. after I put the following at the top of the html view:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

But the dropdown is long with blank at the top and serached result at the bottom. I am glad at least that I get it working in I.E.[/quote]

Wow! That's a doozy. Does switching the doctype to XHTML 1.1 help? This looks to be a CSS issue.

Great job figuring it out. :wow:
#34

[eluser]mikeyhell[/eluser]
Thanks for the contribution but I'm getting the following error with your code.

syntax error
active =
http://server/assets/js/autocomplete/jqu...omplete.js
Line 557

Code:
[removed][removed]
[removed][removed]
[removed][removed]

&lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url(); ?&gt;assets/js/autocomplete/jquery.autocomplete.css" /&gt;
[removed]
$(function() {
    $("#client_name").autocomplete("/edit_customer/search",{
         minChars:3,
         matchSubset:1,
         matchContains:1,
         cacheLength:10,
         onItemSelect:selectItem, selectOnly:1, elementID:'cust_id',
    });
});

function selectItem(li, elementID) {
    $("#"+elementID).val(0);
    var setVal = (li.extra) ? li.extra[0] : 0;
    $("#"+elementID).val(setVal);
}
[removed]

And my controller:
Code:
function search($search)
    {
        $this->db->like('last_name', $search);
        $result = $this->db->get('customers');
        
        if ( $result->num_rows() > 0 ):
            foreach ($result->result() as $c ):
                echo "$c->first_name $c->last_name|$c->id\n";
            endforeach;
        else:
            echo 'No Results Found|0';
        endif;
    }
#35

[eluser]naren_nag[/eluser]
Hi,

I'm sorry, I haven't seen this error before. Line 557 in the js file is a return statement.

Could you tell me when you're getting this error? As soon as you load the view, or when you type something into your input box.

cheers,
#36

[eluser]mikeyhell[/eluser]
Just committed to my dev server and everything seems to be working fine. Guess it was a local server issue. Thanks again, I spent most of my day today trying to hack together another method using the $_get with no avail but this has worked great, just wish I found it earlier.
#37

[eluser]naren_nag[/eluser]
Great!

I know the feeling.

I found the original jquery.autocomplete and kept trying to get it to work with the get method. And then I dived into the js. The code is so well written (and commented) by Dylan Verheul, that I was able to have it up and running in double quick time Smile

cheers
#38

[eluser]Unknown[/eluser]
Thanks for the compliments guys! If you get stuck, you can always e-mail me: <firstname>.<lastname> (at) gmail.com.

Dylan Verheul
#39

[eluser]k00k[/eluser]
Nag's website with the implementation instructions seems to be down. I actually got it all working, but would love to see how some of you have integrated it with CSS for some slick dropdown lists, etc. Any examples?
#40

[eluser]CARP[/eluser]
I second @k00k




Theme © iAndrew 2016 - Forum software by © MyBB