Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Location
    austin, tx
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Textbox AutoComplete Advanced

    Lets say I have 4 simple text boxes:
    Code:
    <!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?

  • #2
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You are looking for something using the XMLHTTPRequest Object and a Database back end...

  • #3
    Regular Coder
    Join Date
    Apr 2005
    Location
    austin, tx
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I figured as much. Not as easy as I thought it might be.

  • #4
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,519
    Thanks
    3
    Thanked 507 Times in 494 Posts

  • #5
    Regular Coder
    Join Date
    Apr 2005
    Location
    austin, tx
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #6
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,519
    Thanks
    3
    Thanked 507 Times in 494 Posts
    up to 4k can be stored in a cookie

  • #7
    Regular Coder
    Join Date
    Apr 2005
    Location
    austin, tx
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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/vwphill...eSelectBox.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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •