I have a custom form with this field in it:
$form['first']['field_city'] = array(
'#title' => t('Woonplaats'),
'#type' => 'textfield',
'#size' => 25,
'#autocomplete_path' => 'taxonomy/autocomplete/field_city',
'#element_validate' => array('taxonomy_autocomplete_validate'),
'#required' => TRUE,
);
I'm trying to use the autocomplete tagging widget to use with an existing taxonomy vocabulary on this form. It works fine tags are loaded when I start typing but if I submit the form I get the following Warning:
Warning: Invalid argument supplied for foreach() in taxonomy_autocomplete_validate()
resulting in this error and the wsod (white screen of death)
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 2:
SELECT base.tid AS tid, base.vid AS vid, base.name AS name, base.description AS description, base.format AS format, base.weight AS weight, v.machine_name AS vocabulary_machine_name FROM {taxonomy_term_data} base INNER JOIN {taxonomy_vocabulary} v ON base.vid = v.vid WHERE (base.name LIKE :db_condition_placeholder_0 ESCAPE '\\') AND (base.vid IN ()) ; Array ( [:db_condition_placeholder_0] => Amsterdam )
I think I'm missing something in the form decleration or made a mistake somewhere. So what's wrong with it? Thanks!
some suggestion is that the machine_name
of the field might be wrong. ( the machine name is actually stad
when I look in the taxonomy in the admin UI).