• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Input field autocomplete

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm attempting to incorporate a feature similar to the ones found in the beta Google Suggest (http://www.google.com/webhp?complete=1&hl=en) or Gmail, where the user's input is dynamically searched against a known list of values, pulled in via XmlHttpRequest. In our case, we're trying to create an alternative to a drop-down of 300-1000 names.

I read the Slashdot post this weekend about how Chris Justus "reverse engineered" the Google Suggest interface (http://serversideguy.blogspot.com/2004/12/google-suggest-dissected.html), and feel this would be perfect for our needs. Unfortunately, my Javascript knowledge is basically non-existent. If anyone would be willing to help me out on this, I'd be greatly appreciative.

P.S. Eric Pascarello, I know you're out there. FYI, I picked up your book last week at B&N.

Thanks,
Jason
[ December 19, 2004: Message edited by: Jason Dixon ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was trying to avoid you! lol! JK

I really like this script here: http://codeproject.com/jscript/jsactb.asp

Another one here: http://www.webreference.com/programming/javascript/gr/column5/

but those are going off of an array.

After I get done wrapping gifts I just bought for my woman I will read the article.

Eric
[ December 19, 2004: Message edited by: Eric Pascarello ]
 
Jason Dixon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Pascarello:

I really like this script here: http://codeproject.com/jscript/jsactb.asp

<snip>
but those are going off of an array.

[ December 19, 2004: Message edited by: Eric Pascarello ]



Yeah, that looks perfect! I don't mind it being in an array... if I need to, I can pre-populate it with the available names (at the time of the request). Ideally, I'd like to incorporate XmlHttpRequest to pull the list dynamically, but this might cause more load than the administrators will allow.

In a perfect world, the input would have the ability to use a different value than what is in the input field (like a drop-down, for example). I'd like to pass a user ID rather than the strings in the array. Can you think of a way of doing this?

Thanks,
Jason
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The one thing you can do is set up either a 2D array or a "parallel array" with the other values. Somewhere in that code is a function that sets the value in the text box. In that function, we need to grab the value from the second array and fill in the hidden text box.

(sent you files via email)

Eric
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic