In Wim's blog, he identified a set of flaws with AHAH forms. Specifically:
"3.If new AHAH-enabled form items are added during an AHAH callback, they don’t work, because Drupal.settings doesn’t get updated."
I have a page which is essentially a grid of < d iv>s. Clicking on a "cell" uses AJAX to load the appropriate form for that cell's content and display it in an overlay < d iv>. (I know this isn't exactly "Web2.0", but some of the content is to complex for direct inline editing.)
For example, one cell type is "narration". This contains a block of text. As part of my system's functionality, this text block can be exported as another type of data: Text Event (which has additional fields). My narration form has a checkbox:"export_as_event" which, when clicked, does it's AHAH "magic" and displays the additional fields.
If I just display the node edit page, the AHAH call works fine.
The problem I have is that none of the AHAH elements in this AJAX-loaded form trigger an AHAH call. Using firebug, I can see the AJAX call to retrieve the form, but when I toggle the checkbox, nada. ...no AHAH call, no errors, n.a.f.t. to tell me what is or isn't happening...
My assumption is that there's some jQuery functionality that isn't getting called when my form is returned via AJAX. As such, I assume that the AHAH element is not getting registered and, so, doesn't trigger the AHAH call.
Again, assuming... I'm guessing the problem lies in the jQuery binding routine. ...the AHAH binding routine was probably written before the jQuery live() method was available and so, cannot register the AHAH functionality on newly rendered form elements.
...'course this is just a WILD guess.
How is Wim's flaw #3 allegedly dealt with? ...'cause it's still not working for me. Is there some JS call I can make to ensure my new elements get the correct AHAH bindings?
Comments
Comment #0.0
PrplPplEtr commentedfixing tags for legibility
Comment #1
vinoth.3v commentedsame issue here
any update?
Comment #2
vinoth.3v commentedComment #3
SGhosh commentedFinally finally found the problem i was looking for....
unfortunately not with its answer!! :/
Comment #4
Anonymous (not verified) commentedI have a similar problem. Has anyone come across a solution?
Comment #5
SGhosh commentedThis problem does remain, but you should totally use the AHAH helper module for ahah in forms. Its awesome. It actually makes using ahah in forms so simple it feels there must be something wrong! ;)
It will help. Do use it. All the best. :)
Comment #5.0
SGhosh commentedanother tag fix