[development] Ahah issues

Richard Morse remorse at partners.org
Fri Jun 25 13:26:06 UTC 2010


Heh. This was my exact question...

Returning settings as a part of the drupal_json call requires overriding the javascript provided by core. ahah_helper and quicktabs both include the code needed in their javascript files.

I prefer the solution used by filefield. That module adds the javascript necessary to extend the Drupal.settings object, which seems to me to be a bit cleaner (if Drupal core changes how they handle the ahah, you don't need to update your local javascript). The file to look at is filefield.widget.inc, v1.7, the filefield_js function.

HTH,
Ricky

On Jun 25, 2010, at 12:29 AM, Lee Rowlands wrote:

> Hi
> Hoping someone can help shed some light on this because I'm getting nowhere
> fast and I'm sure it will be something obvious.
> I've got a form (node edit form) with ahah elements (textfields, radios
> etc). Some of the html returned includes additional form elements that also
> have ahah elements but the ahah behaviours aren't being attached to the new
> elements.
> In my code I'm using the following to return the settings with the data:
> $javascript = drupal_add_js(NULL, NULL, 'header');
>  drupal_json(array(
>    'status'   => TRUE,
>    'data'     => theme('status_messages') . drupal_render($form),
>    'settings' => call_user_func_array('array_merge_recursive',
> $javascript['setting'])
>  ));
> 
> And from the firebug console I can see my new elements in returned json in
> the settings.ahah object but after the ahah submission is finished they
> don't make it to Drupal.settings.ahah so when the ahah behavior is rerun at
> the end of the ahah success callback, my new elements don't get ahah
> goodness.
> Any ideas what I'm missing here?
> Lee Rowlands
> 



The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.



More information about the development mailing list