Autocomlete Widget populate inputs after selection

Autocomlete Widget populate inputs after selection

HI,
PHP / MySQL / CodeIgniter
I have a working Autocomplete Widget that grabs suggestions from a MySQL .db:

Controller:
public function getorganizers()
{
if (isset($_GET['term'])){
$q = strtolower($_GET['term']);
$this->eldata->AutoCompleteOrgs($q);
}
}

Model:
$row_set = array();
$this->db->select('Organization, OrgNo, Postal_Code, Website_URL');
$this->db->like('Organization', $term, 'both');
$query = $this->db->get('event_organizers');
if($query->num_rows() > 0){
foreach ($query->result_array() as $row){

$row_set[] = $row['Organization'];
}
echo json_encode($row_set);
}

View Script:
<script> 
$
(document).ready(function(){
     
$( "#f_sponsor" ).autocomplete({
            source
: 'getorganizers',
            dataType
: 'json',
           
minLength: 2
      });
});
</script>


Instead of returning just the Organization text, I want to return a few other pieces of data from MySQL, and then use those to set various input values when a user selects the suggestion.

If anyone can point me in the right direction, I'd be a happy camper :-)

Donovan


    • Topic Participants

    • lists