[development] Form API: AHAH on fields pulled in via AHAH

Brian Vuyk brian at brianvuyk.com
Wed Sep 22 19:56:44 UTC 2010


Hi all.

I am working on modifying a node form to allow a user to progressively 
select down through a taxonomy tree, and when they have a final term 
selected, update the advanced view arguments for a view-backed 
nodereference field.

I am using AHAH, so that as the user selects a term, the next set of 
potential sub terms will show, in a somewhat similar fashion to how 
Taxonomy Select works.

However, the new select form elements I pull in via AHAH also have 
['#ahah'] attributes themselves. As far as I can tell, the AHAH code 
doesn't seem to trigger for elements that were themselves brought into 
the form via AHAH.

According to http://drupal.org/node/337941, you can get an array from 
drupal_add_js(NULL, NULL, 'header'); which you can in turn pass on to 
drupal_json() in order to attach the AHAH behaviours to elements pulled 
in via AHAH. However, I have tried this with no results.

I would appreciate it very much if someone could take a look, and 
hopefully tell me where I've gone wrong, or what I have to do to get 
AHAH to work on the elements I am pulling in. You can view a copy of the 
module as it current stands at http://drupalbin.com/16170.

Thanks,

Brian


More information about the development mailing list