Closed (fixed)
Project:
AHAH Forms Framework
Version:
5.x-1.5-5
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
17 Aug 2007 at 06:15 UTC
Updated:
21 Jul 2009 at 21:10 UTC
Hello,
I'm playing with this wonderful framework for two days now, and it does a great job. But when trying to add two kind of dynamic expanding elements in a form, it breaks everything.
Maybe I'm just missing something obvious ,but I'm really stuck ... Do you have any example of this working ? I've watched the simple, todos and polls examples, but they don't help for this problem.
Thank you.
Comments
Comment #1
yraber commentedI'm really desperate... spent three days trying to make this work.
It works almost : I can add/delete/modify one element types and add/delete/modify the other element dynamically.
But if I add one of the first type and then try to addone the other type, two are added. It seems that the callback function (diymaps_update_state_js/diymaps_update_states_js) are calles several times.
Here is the code :
Comment #2
dayre commentedI had an issue with attaching ahah bindings to a collection of checkbox form elements. Say i had checkboxes A, B, C and D. When i clicked on A, the ahah javascript properly sent the ajax request to the server. When i clicked on B, i got 2 requests... and C, got 3 requests. The issue was that everytime a "click" or "change" is triggered, the ahah javascript rebinds the click/change function calls to all the elements again. In order to prevent this accumulation of function calls, i had to insert jquery unbind() calls into the ahah_forms.js file. This removes any previous bindings and ensures only one click function associated with each element during every ajax call cycle:
Not sure if this solves your particular problem, but it fixed one of my issues.
My other issue which i haven't resolved yet is i've got two forms on my page of checkboxes... when i add one form, everything works great, but the second form, the ajax submission process get's all screwd up and the ui updates get screwed up... still working on that one.
Comment #3
dayre commentedI resolved my other problem with multiple forms on a page..... fix is here: http://drupal.org/node/180412
Comment #4
dayre commentedOne more comment....
Without this unbind() fix, some of you may be seeing slugish behavior in the browser when you have multiple form elements bound using ahah. This is due to the fact that multiple ajax calls are being made for the same form element trigger...
When unbind is added, things run smooth....
Comment #5
yraber commentedThis is exactly the problems I had.
For now I changed strategy and continued without dynamic forms, but I'll give a try at your patch when I'll have time.
Comment #6
yraber commentedGreat ! It's working ... finally :) Thank you so much.
I think it would be really nice to put this patch into the module distribution.
Cheers,
Yves.
Comment #7
starbow commentedComment #8
starbow commented