Win a flower (🌹) or copy of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java (📚) this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Auto-suggest/Auto-complete fields

 
pioneer
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a requirement to create a form with Auto-suggest/Auto-complete fields. I want to know what affect such fields have on data retrieval and when exactly is data retreived in such cases. Is the data cached once the form is accessed and used for the Auto-suggest/Auto-complete fields?

Thanks.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no general answer for this question--it depends on the back end, how the front end deals with data, how the page is generated, whether or not you're using Ajax, etc.
 
pioneer
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no set answer for this, simply it depends on how you are doing it. :-D

Probably the route you'll take is AJAX and using the onKeyup method. with each onKeyup you either run a database query searching for [WHERE X LIKE value+'%'] or search through an external text file or something.

A quick search found this site with a decent example using an external PHP file with country names:- http://www.dhtmlgoodies.com/scripts/ajax-dynamic-list/ajax-list-countries.php

A quick tip if you have a vast array of data, maybe make the onKeyup only perform an actual search when your input string is say 3 characters long or something.
 
Marshal
Posts: 67357
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try the jQuery UI autocomplete widget if you like. It's configurable to grab it's data in many ways so you can choose whichever best suits your environment, or hook in one of your own.
 
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!