-2

I created a custom autocomplete form in Drupal 7. Its working fine for chrome and firefox. but it's not working for safari and Mac. My code:

function fitnessHomeSearch_form($form, &$form_state) {
  $form['finder_auto'] = array(
    '#id' => 'fsrch',
    '#type' => 'textfield',
    '#title' => 'Find a Location',
    '#autocomplete_path' => 'citynames',
    '#attributes' => array('onchange' => 'this.form.submit();'),
  );

  $form['submit'] = array(
    '#type'  => 'submit',
    '#value' => t('GO'),
  );

  $form['finder_auto']['#attributes']['placeholder'] = t('ENTER CITY');

  return $form;
}

function fitnessHomeSearch_form_submit($form, &$form_state) {
  global $base_url;

  $ex = explode("(",$form_state['values']['finder_auto']);
  $_ex = explode(")",$ex[1]);
  $_SESSION['prelocation'] = $_ex[0];
  $form_state['redirect'] = $base_url."/node/".$_ex[0];             
}
  • So... did you debug it in Safari? – Kevin Jan 11 at 2:46
  • yes. iphone as well – amit joshi Jan 11 at 3:02
  • 1
    What does that mean? Have you done anything other than observe it not work? – Kevin Jan 11 at 3:16
  • yes its not working – amit joshi Jan 11 at 3:44
  • Not enough info. How is it not working? Are you getting any errors in the console? What happens in browsers where it works? What happens (or doesn't) in browsers it doesn't? Where is the rest of your code with the autocomplete callback? – Jaypan Jan 11 at 4:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.