creating "live search" from database text field in Profile Content field Drupal 6 I'm new to Drupal development. I have inherited a Drupal 6 site. I would like to add to the content-profile fields a "live search" text field that will give the user options from a database based on the letters typed. I already have the following:


Database
Profile field with onkeyup function in the .js file.
Function that gets the correct values from the database
any number of tutorials that explain how to use ajax for connecting the onkeyup function and the database query.


What I don't understand is how to put the search results into the "allowed values" of the text field? All the examples define an additional &lt; div > to put the results in. Here it's part of the text field. What code should be in the allowed values so that it will show the correct values? Where to put the retrieved values?

Any help would be appreciated!
You're asking how to make an Ajax search request from a textfield.

I'm not going to answer your exact question but you need some javascript to fill in the results from your sql query into the search field. Here is an example which fills in an HTML &lt;options&gt; list from a Drupal sql search:

jQuery(function($) {

  $('#edit-field-survey-program-und option:gt(0)').remove();
  $('#edit-field-survey-program-und').attr('disabled', 'disabled');

  // When a country is selected. Find the Academic Programs within that
  // country from an SQL lookup. Then fill in the options values and
  // make that options list enabled for the site visitor.
  $("#edit-field-survey-country-und").click(function() {
    var selected_country = $("#edit-field-survey-country-und").val();
    if (selected_country != '_none') {
      // Do our SQL lookup from a service enpoint with a search parameter.
      $.ajax({
        type:'GET',
        url: '/eap-ajax/eap-country-programs/' + selected_country,
        data: '',
          success:function(data){
          // Replace values of target form element with found results.
          // Enable for enduser.
          $('#edit-field-survey-program-und option:gt(0)').remove();
          $.each(data, function(key, value) {
            $('#edit-field-survey-program-und').append(
              '&lt;option value="' + key + '"&gt;' + value + '&lt;/option&gt;'
            );
          });
          $('#edit-field-survey-program-und').removeAttr('disabled');
        }
      });
    }
  });
});


The above example is the same 3 pieces for any AJAX thing.


Make a click event listener function
Do your SQL business logic
Inject your results somewhere back into the page


For a full writeup feel free to see my more complete writeup:
http://blog.arvixe.com/drupal-ajax-autocomplete-dependant-form-elements-using-jquery/

I suggest googling how to fill in results to an &lt;input&gt; text field using jQuery.