1

Auto-complete field not working. I am getting the result in the dropdown box but unable to select any dropdown option. This is the code:-

function _questionnaire_autocomplete($string = '') {
  $matches = array();
  $result = db_select('questionnaire', 'q')
    ->fields('q', array('title'))
    ->condition('title', '%' . db_like($string) . '%', 'LIKE')
    ->execute();


  // save the query to matches
  foreach ($result as $row) {
    $matches[$row->questionnaire_add] = check_plain($row->title);
  }

  //echo "<pre>";print_r($result);exit;
  // Return the result to the form in json
  drupal_json_output($matches);
}

help needed.

2
  • Can you add the form field code as well?
    – Steven
    Sep 30, 2013 at 15:47
  • 4
    Where does $row->questionnaire_add come from? You're not selecting that column...
    – Clive
    Sep 30, 2013 at 15:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.