Drupal 7 ajax from ahah

i have this form:

function tax_assistant_form_alter(&$form, $form_state, $form_id) {
    //questa funzione รจ usata per alterare la disposizione del form originale
    //contenuto in un altro modulo (linkableobject)
    if ($form_id == 'linkableobject_node_form') {
        //Creo funzione per array name vocabulary
        foreach($query as $rec){
        $form["prova"]= array(
        '#type'=> 'select',
        '#title'=> t($rec->name),
        '#ajax' => array(
        //form dei sinonimi        
        $form['sinonimi'] = array(
          // '#type' => 'hidden',
        '#title'=> t('Sinonimi'),
            '#prefix' => '<div id="area_sinonimi">Qui andrebbero i sinonimi',
            '#suffix' => '</div>',

and recall with ajax this function get_synonyms

function get_synonyms() {
    $form_build_id = $_POST['form_build_id'];
    $form_state = array('submitted' => FALSE);
    $form = form_get_cache($form_build_id, $form_state);
    $synonyms = '';
        $tid = $_POST['prova'];
        $result = db_query('SELECT name FROM {taxonomy_term_synonym} where tid=:tid', array(':tid'=>$tid));
        $voc = get_vocabolario($vid);
        if ($tid > 0)
            $synonyms .= "<b>Synonyms for $voc:</b></br>";
        foreach ($result as $rec) {
            $synonyms.= "<i>'" . $rec->name . "';</i> ";
            $keywords[$rec->name] = $rec->name;

        $form['sinonimi'] = array(
            '#type' => 'item',
            '#description' => t("In order to facilitate the cataloging of your learning object,
      try to make use of these terms for its description"),
            '#value' => $synonyms,

    form_set_cache($_POST['form_id'], $form, $form_state);

    $form = form_builder($_POST['form_id'], $form, $form_state);


    drupal_json_encode(array('status' => TRUE, 'data' => $output));


but give me this error Recoverable fatal error: Argument 1 passed to drupal_array_set_nested_value() must be of the type array, null given, called in /var/www/html/glorep/includes/form.inc on line 2532 and defined in drupal_array_set_nested_value() (line 6598 of /var/www/html/glorep/includes/common.inc). I think the probles is ajax, i have upgrade this from D6 when there is D6, but i can understand how modify, can someone help me?


  1. Please read this https://drupal.org/coding-standards and update your code.
  2. You're adding form element ($form["prova"]) with the same name in loop. So each iteration will replace existing element with new one.
  3. Check value of $tid = $_POST['prova']; because it depends from which options was set for this select box. I expect that you didn't set the keys for options.
  4. Check arguments of drupal_array_set_nested_value() function.
  5. Install and configure xdebug and will be able to find a bug in 1 minute.

Need Your Help

How do I stop pyCharm from complaining about underscore strings?

python pycharm wxglade

I'm programming in pyCharm making a wxPython project (Mostly generated from wxGlade). If I have some code which specifies a string e.g.:

Facebook Chat using XMPPFramework on iPhone

iphone cocoa-touch facebook xmpp

Does someone already created an iPhone app that connect to the Facebook chat server using their X-FACEBOOK-PLATFORM authentication mechanism and XMPPFramework ?