I have a custom content type with a taxonomy field handled by TaxiSelect, but after attempting creating a new term (i.e. typing in the term using the format "PARENT >> NEW_CHILD_TERM" and clicking the "Add" button next to the input field) the TaxiSelect widget disappears entirely from the document.

CommentFileSizeAuthor
#6 screenshot.png54.03 KBnaero

Comments

sczizzo’s picture

It appears to be an error in the AHAH calls. Everything works fine for adding the first term (on each page load), but after adding a second term, drupal responds with the following JSON:

  { "status": true, "data": "" }

I feel like this might have something to do with form caching, but I can't be sure.

alan d.’s picture

Status: Active » Postponed (maintainer needs more info)

This is not much to go on.

Any related error messages in the logs, etc?
What related taxonomic / i18n modules are in play?

sczizzo’s picture

We're using more than a few taxonomic modules, most importantly:

  • Taxonomy (6.20)
  • Content Taxonomy (6.x-1.x-dev)
  • Taxonomy Menu (6.x-2.9)

The event shows up in the logs as a PHP error at locations of the form http://mydrupalsite.com/taxiselect/ahah/std/taxonomy%ENCODED_STUFF% with the following message:

array_shift() [<a href='function.array-shift'>function.array-shift</a>]: The argument should be an array in /path-to-mydrupalsite.com/sites/all/modules/taxiselect/taxiselect.pages.inc on line 113.
alan d.’s picture

Is there caching involved here? Do other AHAH functions work on that page?

The reason that I'm asking is that this code is also part of the FileField / ImageField, used by 1000's for sites. The only time that I have seen this fail is when there is a server is down or the page is not saved for many, many hours and Drupal form cache is flushed before the AHAH callback gets used.

sczizzo’s picture

We're using standard drupal caching (set to "normal"). Other AHAH elements seem to work fine (even on some relatively complex content types), and even after TaxiSelect fails these other AHAH elements continue to operate.

naero’s picture

StatusFileSize
new54.03 KB

To add to sczizzo's post (I work with him)...

So I copied the entire site to our dev server, uninstalled all of the unessential modules (literally 70 or 80!), turned off clean URLs, and restricted a our test content type to our test taxiselect vocabulary. I switched entirely to the Garland theme. Still, the form disappears.

I took a look at our logs and saw this (see attachment). I'm not sure if this helps any.

naero’s picture

And per that screenshot, that specifically references this code in the file 'taxiselect.pages.inc':

function taxiselect_add_ahah($parents) {
  module_load_include('inc', 'node', 'node.pages');
  module_load_include('inc', 'taxonomy', 'taxonomy.admin');

  $form_state = array('submitted' => FALSE);
  $form_build_id = $_POST['form_build_id'];
  $form = form_get_cache($form_build_id, $form_state);
  $args = $form['#parameters'];
  $form_id = array_shift($args);  // <-- row 114!
  $form['#post'] = $_POST;
  $form = form_builder($form_id, $form, $form_state);

  $_parents = $parents;
  $parents = explode('][', $parents);
  $target_form = $form;
  while ($key = array_shift($parents)) {
    $target_form = $target_form[$key];
  }
  // Clear the element if no errors found
  if (!form_get_errors()) {
    $target_form['add']['taxiselect']['#value'] = '';
  }
  unset($target_form['#prefix'], $target_form['#suffix']);
  // ahah returns the full element and messages
  $output = theme('status_messages') . drupal_render($target_form);

  drupal_json(array('status' => TRUE, 'data' => $output));
}
naero’s picture

Hi Alan,

Any other ideas? Is there any information we can provide you with?

Our Filefield forms are working as expected.

alan d.’s picture

I'm at a loss to explain or replicate this sorry. I'm really not sure how to proceed :(

higherform’s picture

It appears to us that using taxiselect inside of Panels completely borks the AHAH for taxiselect. If taxiselect is used inside of Panels, taxiselect_add_ahah() does not get the variables it needs by line 119 of taxiselect.pages.inc:

form_build_id : form-d2ee38706048296bb7ee2333ccddb6b5

form : (empty/null)

It seems to be form_get_cache() fails to do its job here. It also appears that no cache_form row exists with the id I get for any taxiselect AHAH inside of panels. So I suspect its a form_set_cache() problem... now I just have to trace that part too, which I don't have time to do right now.

alan d.’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Caching issue :( Nuke as much caching on those panel pages.

I have no plans to further develop this module. This is due to time limitations, internal complexities and very low uptake (<2%).