...

View Full Version : Textbox AutoComplete Advanced



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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>TextBox Fill-In</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<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">
</form>
</body>
</html>

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?

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

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

vwphillips
07-06-2005, 08:14 PM
see

http://homepage.ntlworld.com/vwphillips//FormCompendium/FormCompendium.htm#f12

sftl99
07-06-2005, 09: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!

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

sftl99
07-06-2005, 09: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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum