Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function _cities_autocomplete($string) {
- $matches = array();
- $result = db_select('Route', 'c')
- ->fields('c', array('Location'))
- ->condition('Location', '%' . db_like($string) . '%', 'LIKE')
- ->execute();
- // save the query to matches
- foreach ($result as $row) {
- $matches[$row->Location] = check_plain($row->Location);
- }
- // Return the result to the form in json
- drupal_json_output($matches);
- // print(drupal_json_output($matches));
- }
- $form['op']['#autocomplete_path'] = 'cities/autocomplete';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement