View Full Version : Textbox AutoComplete Advanced

07-06-2005, 05:22 PM
Lets say I have 4 simple text boxes:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>TextBox Fill-In</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<form name="form1" method="post" action="">
Customer # <input name="CustomerNumber" type="text" id="CustomerNumber"><br>
Company Name <input name="CustomerName" type="text" id="CustomerName"><br>
Contact Name <input name="ContactName" type="text" id="ContactName"><br>
Email Address <input name="RecipEmail" type="text" id="RecipEmail">

I want to be able to fill in the CustomerNumber and IF that number has been previously defined in the Javascript, CustomerName, ContactName, and RecipEmail will be automatically completed.

Example: if I type in "12345" into CustomerNumber I will get an output of "Bob's Furniture" in the CustomerName, "Bob" in the ContactName, and "bob@bobfurniture.com" in RecipEmail. But if I type in "54321" and it is not defined, the other three are simply left blank for me to type in manually.

Note: It would be even better if every time I manually entered one, the other three fields were stored in a database...but I'll save that one for another day

I know I have seen similar scripts with dropdowns, but never with a textbox and I haven't found one that works anywhere close to the way I desire. Anyone have ideas?

07-06-2005, 08:13 PM
You are looking for something using the XMLHTTPRequest Object and a Database back end...

07-06-2005, 08:16 PM
I figured as much. Not as easy as I thought it might be.

07-06-2005, 09:14 PM


07-06-2005, 10:30 PM
not quite what i'm looking for, but a very cool script. i've looked into this more and i'm pretty sure i'm going to need to set up a MySQL database...which i have no idea how to do!

07-06-2005, 10:51 PM
up to 4k can be stored in a cookie

07-06-2005, 10:58 PM
it's not a cookie thing i'm trying to do. it's more similar to this example on your page: http://homepage.ntlworld.com/vwphillips//FormCompendium/PopulateSelectBox.htm.

except instead of select boxes it's text boxes. here is my live example where i am wanting to eventually implement this. www.jasonpcarroll.com/allcomponents/quote.html. See the right column...I want to be able to fill in the Customer # and have Customer Name, Contact, and Customer Email automatically fill in. I would have at least 10 different Customer #'s with the other variables assigned.

Do you think it's doable just in Javascript? I could just start out using 3 or 4 customer #'s and wait until I figure out the database method before I go crazy.