implementing an auto-complete in codeigniter help |
[eluser]DumpProgrammer[/eluser]
I am thinking of expanding my application by implementing an autocomplete field but the tutorials I have seen do not really help much on someone like me who has little knowledge of jquery or ajax. Anyways I have one I am found which is really easy to use but I am not sure on what to add on the datasource. The example goes to the file but I am using codeigniter to call a model. Here is a section where I am not sure what to put Code: // instantiate remote data source
[eluser]fraserk[/eluser]
The datasource should point to the get_authors function. something like. Code: var oDS = new YAHOO.util.XHRDataSource("<?php echo base_url();?>index.php/controller/get_authors/");
[eluser]markowe[/eluser]
How about just using the (open-source) Scriptaculous library? That has a one-line command for producing auto-complete fields - good for people like me who don't want to get into the nitty-gritty of web 2.0 programming.
[eluser]DumpProgrammer[/eluser]
[quote author="markowe" date="1265035197"]How about just using the (open-source) Scriptaculous library? That has a one-line command for producing auto-complete fields - good for people like me who don't want to get into the nitty-gritty of web 2.0 programming.[/quote] Does that also work with retrieving the values from a database?
[eluser]markowe[/eluser]
[quote author="DumpProgrammer" date="1265038809"][quote author="markowe" date="1265035197"]How about just using the (open-source) Scriptaculous library? That has a one-line command for producing auto-complete fields - good for people like me who don't want to get into the nitty-gritty of web 2.0 programming.[/quote] Does that also work with retrieving the values from a database?[/quote] Well, yes. Actually, I may have mislead you slightly with the "one line" thing, I was referring to the actual AJAX call. The AJAX calls whatever script you have written (more than one line!) to fetch your data and creates the dropdown and everything else. So yes, your PHP will pull the data out of your dbase and create an unordered list and return it to the AJAX call. But it's a lot simpler with Scriptaculous, the only thing is that the script takes up a lot more space because it's got all sorts of other JavaScript goodies. Check out this tutorial: Check out this tutorial. I do actually KIND of wish I had learned to do it the hard way first so at least I know what's going on behind the scenes, but this certainly saves time and nerves.
[eluser]DumpProgrammer[/eluser]
Great tutorial Markowe it looks easy to implement thanks |
Welcome Guest, Not a member yet? Register Sign In |