Click to See Complete Forum and Search --> : javascript autocomplete


waskelton4
02-05-2003, 09:38 AM
Hello Forum,

I'm looking for a script that i hope you can help me with here..

I have a form where users will need to choose items from a list, generally two or three, but the list is rather long so a multi-list form element won't work that well. (not with these users at least)

some of the entries that they users will be making also might not be in the database so they'll need to be added..

What i'd like to do is have about 5 text boxes and when the users begin typing into the text boxes.. the script searches (through an array pulled from the database i suppose) and completes what they are typing.. if they end up typing a word that isn't in the array.. then i'll add it to the database for next time..

anyone know of a script out there that i might be able to adapt to suit my needs.. i'm not that great of a javascript programmer so i'm not sure that i could do this from scratch, but i can probably modify one to do what i need to..


Thanks
Will

khalidali63
02-05-2003, 10:09 AM
I seriously doubt that there would be something writtenin javascript for this purpose.
Its very customazed code.
Well here is a suggestion that may lead you to the final app.
Oh btw. this type of funtionality will be hella slow over the internet.Intranet may be ok.

Use jsp/asp.

make all the textfields mouseup sensitive
by adding onmouseup="autoComplete();"

where in auto complete function you create a variable with the mouse up to date string in the text field and then pass it to ur database whichh will return the results and populate the most matching in the field.

Intersting project.I hope I helped.

Khalid

waskelton4
02-05-2003, 10:48 AM
Thanks Kahlid,

I've already written my DB app in PHP..

what i had in mind was acutally querying the database for the list and putting it straight into a javascript array.. then doing a search on the client through the array as the value of the text box changed...

make sense? sound like it's possible?

hell, maybe i'll try and take on my first real javascript program..



btw, this is an intranet.

thanks for your reply.
will

kronck
09-06-2003, 11:33 AM
Im looking for somethink like this as well, minus the ability to add into the DB if the name does not exist. Similar situation though, PHP, MYSQL, looking to be able to select from a list in the DB already, and can but would like to add a autocomplete function to the list. Does anyone have any Recomendations?