fill in as you type

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/67723?pagenum=1
05 November 2025, 03:12

Topic


Etymon
fill in as you type
09 September 2008, 09:43


Does anyone know what it is called when a search box is filled in for you as you type?
I think YouTube has this feature for their search box.<

 

Replies ...


MarcelG
09 September 2008, 10:07


Mmm, let's see:
- autocomplete
- Google Suggest - Auto Suggest<
Etymon
09 September 2008, 10:08


Thanks Marcel!
I just needed some search terms to Google it.
Etymon
<
balexandre
09 September 2008, 11:34


it is easy to create a MOD for that, but you need to consider what do you want to be complete textbox...
there is always to ways:

- an Offline, when the user page loads all the words are already in the code ready to be used, and it is the fastest
- an Online, where it uses AJAX technology to query the database using the word that the user just wrote, then get the results and write as a dropdown... this take time depending on the user connection and your forum / database, and per each letter there is a new query sent to the database.
if you want help... please let us know what do you want to accomplish.<
Etymon
09 September 2008, 12:58


Thanks for the help on that. smile
Maybe the autocomplete is not what I am looking for specifically.
What I want it for is Private Messages for the Send to: textbox. I just want it to autocomplete available member names.
<
balexandre
09 September 2008, 13:31


how good / comfy are you with ASP / HTML / Snitz?<
Etymon
09 September 2008, 13:33


It's like home to me. smile (um, well, most of the time tongue)<
balexandre
09 September 2008, 14:04


good...
here you have:

http://www.balexandre.com/snitz/autocomplete/

now all you need, is to apply a query to get all names/emails form the current user and format it accordingly

to test the emails you can see the code, to see what names can you search.
Hope that this give you the way to build what you need.<
Etymon
09 September 2008, 14:10


Hey! bigsmile
I saw jQuery as I was searching.
I'm assuming that I need to do a view source, get the files and go from there.
Thanks balexandre! <
Etymon
09 September 2008, 14:16


Javascript is one of my weaker points.
In var emails below, how do I query the db and put the results into a list like below? I know ... talk about an Achilles heel.
var emails = [
{ name: "Peter Pan", to: "peter@pan.de" },
{ name: "Molly", to: "molly@yahoo.com" },
{ name: "Forneria Marconi", to: "live@japan.jp" },
{ name: "Master <em>Sync</em>", to: "205bw@samsung.com" },
{ name: "Dr. <strong>Tech</strong> de Log", to: "g15@logitech.com" },
{ name: "Don Corleone", to: "don@vegas.com" },
{ name: "Mc Chick", to: "info@donalds.org" },
{ name: "Donnie Darko", to: "dd@timeshift.info" },
{ name: "Quake The Net", to: "webmaster@quakenet.org" },
{ name: "Dr. Write", to: "write@writable.com" }<
balexandre
09 September 2008, 14:34


that's ASP ... forget that is Javascript, all you need to do is very simple, look:

You need to grab the name and email using a SQL Query, I do not have the PM mod and never used (I think that takes the essential of a forum), but I will do this as steps.
the code you see there is:
<script type="text/javascript">

// Emails that you can use in auto complete
var emails = [
{ name: "Peter Pan", to: "peter@pan.de" },
{ name: "Molly", to: "molly@yahoo.com" },
{ name: "Forneria Marconi", to: "live@japan.jp" },
{ name: "Master <em>Sync</em>", to: "205bw@samsung.com" },
{ name: "Dr. <strong>Tech</strong> de Log", to: "g15@logitech.com" },
{ name: "Don Corleone", to: "don@vegas.com" },
{ name: "Mc Chick", to: "info@donalds.org" },
{ name: "Donnie Darko", to: "dd@timeshift.info" },
{ name: "Quake The Net", to: "webmaster@quakenet.org" },
{ name: "Dr. Write", to: "write@writable.com" }
];

so you do something like.
<script type="text/javascript">

// Emails that you can use in auto complete
var emails = [
<%
usernameID = "1" ' I dont know where the PM gets the current ID
strConnString = "SELECT NAME, EMAIL FROM TABLE WHERE USERID = " & _
chkString(usernameID,"SQLString")

set my_Conn = Server.CreateObject("ADODB.Connection")
'on error resume next
my_Conn.Open strConnString

while NOT my_Conn.EOF

%>
{ name: "<%= myConn("NAME") %>", to: "<%= myConn("EMAIL") %>" },<%

my_Conn.moveNext()
wend

my_Conn.Close
set my_Conn = nothing
%>
];


something like that...
if my ASP is wrong please let me know, to much time sick around bed with no code whatsoever... I'm getting blanks now sad

and here you have smile a zip file (test it please, i'm on a )

http://www.balexandre.com/snitz/autocomplete.zip<
Etymon
09 September 2008, 14:42


I feel like a blackeye
You made it so simple for me. Thank you!
I hope that you are feeling better soon!
<
balexandre
09 September 2008, 14:48


glad it helps...
I know it's a virus, but no one knows witch one, so, no treatment, just fevers sad
been like this for more than 3 weeks now ... sad<
Etymon
09 September 2008, 15:33


It's NO fun being sick! dead
I just got over something myself. Don't want to go there again!
Thank you again for the help.
Sincerely,

Etymon
<
© 2000-2021 Snitz™ Communications