Thanks Jörn, I hope you get to do that eventually, and meanwhile, I
thought the wrapper code may be of use to someone out there. So here
it is:
$(document).ready(function() {
  $(".ac_input").attr({ disabled: "disabled" });
  $.getScript("http://127.0.0.1/kg/js/jquery.autocomplete.js";,
function() {
  $.getScript("http://127.0.0.1/kg/js/jquery.form.js";, function() {
  $.getScript("http://127.0.0.1/kg/js/dimensions.js";, function() {
  $.getScript("http://127.0.0.1/kg/js/jquery.bgiframe.min.js";,
function() {
  $(".ac_input").removeAttr("disabled")
  $(".ac_input").each(function() {
    var tbl_id = this.id;
    var tbl = tbl_id.slice(0,-3);
    var search_uri = '../summary_provider.php?t=' + tbl;
    var this_hid = '[EMAIL PROTECTED]' + tbl_id + ']';
    $('<input type="hidden" name="' + tbl_id + '"
value="">').appendTo("#hids")
    $('#' + tbl_id).autocomplete(search_uri);
    $(this).result(function(event, data, formatted) {
      $(this_hid).val(data[1]);
    });
  });
  });
  });
  });
  });
});

This code works if some conventions are adhered to and a unique
backend script exists to return results based on a table name and the
query string. This in the above script is summary_provider.php. The
convention is explained by two examples:
Example 1
Input id: user_id
Column name in user_position table: user_id
Original table name: user
Column name in original table: user_id
URI to return results: summary_provider.php?t=user
Example 2
Input id: position_id
Column name in user_position table: position_id
Original table name: position
Column name in original table: position_id
URI to return results: summary_provider.php?t=position

Cheers
Majid

Reply via email to