Best way to implement auto-complete?

  • Thread starter The Natural Philosopher
  • Start date
T

The Natural Philosopher

I have an app where people using it are under time pressure to select a
customer from a list of existing, or complete the entry for a new one.

Downloading enough info to have a local data array of the existing
customers is fine, and to date they have either had the option of
selecting from a huge flyout, and existing customer, or typing in a form
for a new one.

Browser compatibility is not an issue. It would be firefox and IE7 only,
and if it has to be firefox alone, that is acceptable.

Now what I would like to do is have, as they type, a popup list of
reasonable possibilities come up, so the question is:

What event is best to trigger this from keystrokes in an input field.?

Can I read a partially completed text input box?

If those are possible, the rest I can do.
 
R

rf

The said:
I have an app where people using it are under time pressure to select
a customer from a list of existing, or complete the entry for a new
one.

OK. So many customers, so little time :)
Downloading enough info to have a local data array of the existing
customers is fine, and to date they have either had the option of
selecting from a huge flyout,
Ouch!

and existing customer, or typing in a
form for a new one.

Until the customer base gets large :)
Browser compatibility is not an issue. It would be firefox and IE7
only, and if it has to be firefox alone, that is acceptable.

What does browser compatibility have to do with this. Code correctly and
it'll work in all current and future browsers.
Now what I would like to do is have, as they type, a popup list of
reasonable possibilities come up,

Just like google does when you start typing in a search argument? Although
google is hiving off the host with a bit of AJAX skulduggery, not that this
in itself is very startling technology.
so the question is:
What event is best to trigger this from keystrokes in an input field.?

Probably onchar.
Can I read a partially completed text input box?

What does "partially completed" mean? Really, the input box is complete all
the time, as far as it is, but the user might just type something more in,
if that makes sense. You can read the *current* content of a text box any
time you want to.
If those are possible, the rest I can do.

Check out how google does it.
 
T

The Natural Philosopher

rf said:
OK. So many customers, so little time :)


Until the customer base gets large :)

Unlikely to ever exceed 10,000 )(about 800 at the moment)and certainly
less than 100 bytes of data per customer..name postcode..that's it
really to allow a reasonable selection.
What does browser compatibility have to do with this. Code correctly and
it'll work in all current and future browsers.
Sometimes the lowest common denominator way of doing things is pretty
poor..Ie6/7 is as I have discovered, crap at searching the DOM.

Just like google does when you start typing in a search argument? Although
google is hiving off the host with a bit of AJAX skulduggery, not that this
in itself is very startling technology.

Nope. its not.
Probably onchar.

Ah. That's a useful hint. I'll look into that.
What does "partially completed" mean? Really, the input box is complete all
the time, as far as it is, but the user might just type something more in,
if that makes sense. You can read the *current* content of a text box any
time you want to.

Ok. I wasn't sure that you could.

So onchar triggers an event that reads the current content, and adjusts
what's in the flyout..sounds about purrfect to me.

If that general approach works, I'll use it for other things too.
Check out how google does it.
Hmm. Don't want to be as massively complex as that. Page sizes in this
case can be relatively large - generally only happens on a LAN and
compression takes care of the WAN data. I've have discovered that HTML
compresses massively. All that repetition ;-)
 
T

The Natural Philosopher

Conrad said:
If you can find a browser that knows about a "char" event, that is.
indeed.. However it led me to onkey..stuff which is good enough.

As long as its tied to the input box and doesn't trogger on other stuff.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top