Steps to reproduce: (best seen with Firebug)
1. Open ahah/simple page.
2. Click on 'click me' button: 1 post request is sent, wrapper text changes; So far so good
3. Click on button again. The screen looks all right, but the firebug console shows that 2 (similar) POST requests were made.
4. Click on button again. This time, 4 requests were made.
5. And so on. The number of POST requests doubles every time.
The only way for the user to get rid of this behaviour on the page is to refresh the page, which defeats the purpose of the module.
The DOM tab of firebug shows that the submit button gets additional event handlers each time it gets submitted.
Interestingly, the todos example doesn't have this problem. So maybe it's not a bug in the module's code, but in the way the simple page is designed. But I can't find the catch.
Assuming it is a bug, the offending line of code is in ahah_simple.js#45-46
// re-attach event listeners to newly generated html
Ahah.attach_all_bindings( element.wrapper );
which just needs to be commented.
The simple example (and others just like it) work fine. The Todos example seems to be working just fine also after the change. But possibly this breaks other, more compelx, uses of this module. Any help would be appreciated for those of us still stuck with Drupal 5.x.
Comments
Comment #1
starbow commentedHmm, sounds like a bug in attach_all_bindings. The ahah trigger behavior should only be applied to the replaced elements defined by element.wrapper.
I am sorry bu it is unlikely that I am going to take the time to track this down. Doing AHAH with the D5 FAPI is just too complicated to be worth the effort.
Comment #2
yaoweizhen commentedComment #3
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.