Scriptaculous Autocomplete
An Ajax autosuggest script is supposed to help the visitor and present in real time (as they type) some possible results based on their entered words/characters. In my opinion, this is a great feature to enhance the user experience. It's very easy to build an autocomplete form using scriptaculous and prototype. You just need one line of javascript <br /> <strong> new Ajax.Autocompleter(id_of_text_field, id_of_div_to_populate, url, options); </strong>
nice example. thanks. is it possible to get a loading image?
Will you plz put your source code, The original code doesn't work with navigation keys!
I like way of coding style but i still cant able to get source code for response.php can you plz help me as soon as you can
I too would be interested in seeing the code for response.php
Using the arrow keys (up) to navigate through the autocomplete list causes a page jump when the browser's view port is smaller than the list's length. How can i fix that ;-( ?
I too would be interested in seeing the code for response.php Does it returns an unordered list?
DOUGH!! response.php source :P It returns an unordered list, but... What is the <div class="entry"> for?
Do you have any idea why the font of the elements in the auto-suggestions list looks different IE than the one in Firefox?
As if the font-family CSS-property is totally ignored in IE.
The thing is that in IE the font anti-aliasing is lost after fading the text. There is no (obvious, simple) way to fix it though, so probably we'll have to live with this.
Nice tutorial thx! But the link to "Read more and download "Scriptaculous Autocomplete"" does not work ;) would be pleasant to fix it
Do you know if I can control the ajax request. For exemple, do nothing if the input in numeric... ?
can i replace 'response.php' with asp page
hi, it dosnt work in the example
what exists in response.php? Is a cruel doubt...
The download script does not work it also do not contain the database values
The 'response.php' just returns a dataset in that format : <ul> <li>country1</li> <li>country2</li> .. </ul>
@DataSkill yes, in html, where you want you should write a div or a span like this: <span id="loader" style="display:none"><img src="img/loading.gif"> Loading...</span> and add the indicator option in Ajax.Autocompleter('search','update','response.php', { indcator:'loader'}); try this. bye
@DataSkill sorry, html tag won't work in this list. {span id="loader" style="display:none"}{img src="img/loading.gif"}Loading...{/span} and add the indicator option in Ajax.Autocompleter('search','update','response.php', { indicator:'loader'}); try this. bye
When I'm using the arrow buttons (up and down) to select an item from the list the whole page is scrolling. Anyone knows how to help this problem?
Hi -- this works great for a list, but I need an AutoComplete to show a table. I can have it present a scrollable table with a fixed header and footer, but when I select a row it does not return anything. I get a "$(element) has no properties" from effects.js. Is it possible to hook a table into this function? If not, can I do something like emulate a fixed column list (5 columns per row)?
I wonder if setting position:fixed for the header might aleviate the body scroll issue. Alternatively, you can captcure the arrow up key function using javascript and have it scroll the document body 0 pixels every time it is pressed. This should override the browser.
You'll notice if you go to a site, and the input is focused, no body scrolling occurs.... so add [CODE] onkeypress = document.getElementById('q').focus(); [/CODE] worked great for me. if any of you need a onkey that loops (the top goes to the bottom result & vice versa) hit m e up at falkon303@gmail.com. - Best
Here's the code I wrote - <HTML> <HEAD> <style type="text/css"> .over {background-color:#00FF00;} .out {background-color:#FFFFFF;} </style> <SCRIPT> function getArrows (evt, curval) { var keyCode = document.getElementById ? evt.keyCode : 0; var rowsel = curval.split('_'); if (keyCode == 40) { document.getElementById('q').focus(); term = (parseInt(rowsel[1]) + 1);ac = 'ac_1';} else if (keyCode == 38) { document.getElementById('q').focus(); term = (parseInt(rowsel[1]) - 1);ac = 'ac_9';} document.getElementById(curval).className = 'out'; if (document.getElementById(rowsel[0] + '_' + term) == null) {numinc = ac;} else {numinc = rowsel[0] + '_' + term;} document.getElementById(numinc).className = 'over'; document.getElementById('q').value = numinc; return true; } </SCRIPT> </HEAD> <BODY ONKEYDOWN="getArrows(event, document.getElementById('q').value)"> <ul id="ac_list" name="ac_list"> <li id="ac_1" name="ac_1" onMouseOver="this.className = 'over';document.getElementById('q').value = this.id;" onMouseOut="this.className = 'out';" >this 1</li> <li id="ac_2" name="ac_2" onMouseOver="this.className = 'over';document.getElementById('q').value = this.id;" onMouseOut="this.className = 'out';" >this 2</li> <li id="ac_3" name="ac_3" onMouseOver="this.className = 'over';document.getElementById('q').value = this.id;" onMouseOut="this.className = 'out';" >this 3</li> <li id="ac_4" name="ac_4" onMouseOver="this.className = 'over';document.getElementById('q').value = this.id;" onMouseOut="this.className = 'out';" >this 4</li> <li id="ac_5" name="ac_5" onMouseOver="this.className = 'over';document.getElementById('q').value = this.id;" onMouseOut="this.className = 'out';" >this 5</li> <li id="ac_6" name="ac_6" onMouseOver="this.className = 'over';document.getElementById('q').value = this.id;" onMouseOut="this.className = 'out';" >this 6</li> <li id="ac_7" name="ac_7" onMouseOver="this.className = 'over';document.getElementById('q').value = this.id;" onMouseOut="this.className = 'out';" >this 7</li> <li id="ac_8" name="ac_8" onMouseOver="this.className = 'over';document.getElementById('q').value = this.id;" onMouseOut="this.className = 'out';" >this 8</li> <li id="ac_9" name="ac_9" onMouseOver="this.className = 'over';document.getElementById('q').value = this.id;" onMouseOut="this.className = 'out';" >this 9</li> </ul> <input name="q" id="q" type="text" value="ac_9"> <input name="length" id="length" type="hidden" value="ac_9"> </BODY> </HTML>
I changed the script php in asp classic, it works perfectly in IE while in Firefox does not work and there aren't errors in the console. Why?
That's not works by me
Tu ejemplo es muy bueno pero es posible que tambien puedas colocar el archivo response.php, lo que sucede es que estoy elaborando un sitio web, el problema es que no se ejecuta en firefox, al parecer un error en controls.js, mi correo es raulmace@hotmail.com, gracias.
it's greattt! i like it
this is be very helpfull for my applications. thanks
Gold, especially with that loader image. Wroks great thanks.
Very nice tutorial. Thanks!
bullshit doesn't work with opera
Just trying it out!
dosn't work with ie9!!!!!
This is not working for me in IE6 and FF 3.6 not even the example you have here...
This does not work in IE 9