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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Help with auto-completion of input boxes

    It seems I can't code my way out of a paper bag.. I am, however usually good enough with google to find what I want but I keep finding the wrong information

    I'm hoping some of the ajax/php gurus out there can help me out a bit.

    Basically I'm trying to make a inventory tracker to scan out products from my warehouse. The idea being that when a product is sold the barcode and serial numbers of the product will be scanned so I can determine exactly what is no longer in the warehouse.

    So I've got a 'Products' database with the following fields: ProductUPC (barcode) ProductPartNumber (unique 6 digit code for each product) ProductDescription (description of the product).

    On my HTML form I've got a bunch of text boxes (UPC, Part Number, Description & Serial Number).

    I want to be able to scan the UPC of the product and have the Part Number & Description fields auto-complete with AJAX/PHP wizardry so that these fields don't need to be entered manually..

    Then all that needs to be done is for the serial number barcode to be scanned and boom the results end up in the 'Requests' table

    Sounds relatively straightforward but I keep getting auto-suggest stuff for the one field

    Any help is hugely appreciated

  • #2
    GŁtkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    What you're asking for is as simple as it gets: Once you have the UPC, you start an AJAX request to get that other data from the database (say, as JSON); then you put it into the fields. Unless I misunderstand, that's as basic an AJAX call as you could get, and there's not much to it.

    In all honesty, you don't even need that AJAX call. Just do a normal form submission for the UPC. Your server script can do with it whatever it has to do, like look up the product and put something in the 'Requests' table. Then it can send back the info to the browser, if you're still interested in seeing that.

    Also, it sounds like bad design, if you need all the data of a product in order to put it into another table. I don't really know your business logic, but typically you would just put the primary key of the product into another table, in order to keep your database normalized (and not to add redundant data).

  • #3
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the awesome response!

    I'm terrible at coding/web development - this stuff is on an internal server and it's not going to have tons of records so I'm not too bothered about efficiency/performance.

    The purpose of the information being in the browser is so that whoever inputting the data can verify it before submission.

    Any links to some sample code?

    Cheers

  • #4
    GŁtkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    I'm not sure what sample code I should point you to, since what you want to do, while quite simple, does involve the whole spectrum of technologies. I suppose you're fine with the PHP/MySQL part; for the client side part (AJAX, DOM manipulation), you could look into jQuery, which should make the task quite easy.

    Of course, if you're really terrible at coding, you might want to consider hiring a professional.

  • #5
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks again for the response..

    The annoying thing is - I had something in jQuery that worked with one of the fields which now I'm thinking would be acceptable.. I seem to have lost it :'(

    Ahhh well - I'll keep looking.

    I'm not really prepared to pay for this as it's my employer that will benefit and as they are pretty much one of the biggest companies in the world I don't want to be paying for it

    Thanks

  • #6
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,765
    Thanks
    55
    Thanked 518 Times in 515 Posts
    ... if you're looking for a jQuery autocomplete, I use this one and I'm very happy with it.


  •  

    Tags for this Thread

    Posting Permissions

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