Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-01-2012, 12:25 AM   PM User | #1
jlimited
New Coder

 
Join Date: Sep 2006
Posts: 32
Thanks: 5
Thanked 0 Times in 0 Posts
jlimited is an unknown quantity at this point
Autocomplete with hidden ID

Hello,

I am trying to simplify data entry for a web form. I found a good autocomplete script that I really like and have been using for a while. This is the first time that I am using an autocomplete form to add an entry into a database that has referential integrity between two tables. (Normally I just send and email or do a direct data dump into a database table).

What I would like is to have a form that display to the user the first/last name of the customer and in the background a hidden input or the tag value gets updated with the associated database ID for that customer.

Here is the data.php code.

PHP Code:
        $sRequest "SELECT `ID`,`NAME` FROM `customers` WHERE `NAME` LIKE '%{$sParam}%'";
        
$aItemInfo $GLOBALS['MySQL']->getAll($sRequest);
        foreach (
$aItemInfo as $aValues) {
            echo 
$aValues['NAME'] . "\n";
        }
        break; 
Code:
$(function(){
    $('.name').autocomplete('data.php?mode=sql', {
        width: 200,
        max: 5
    });
});
The Autocomplete JS file is very hard to read...The source code came from here.
http://bassistance.de/jquery-plugins...-autocomplete/

If someone can provide a link to an article that discusses how to return the ID in a hidden field, I can do the reading and code translation. Just need some assist on what would be a good method.

Thanks
Jlimited
jlimited is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:28 PM.


Advertisement
Log in to turn off these ads.