Not working on forms loaded via AJAX

jm.federico - September 16, 2009 - 10:49
Project:Ajax
Version:6.x-1.14
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi

First thing: This is A GREAT MODULE. Love it!

I have a DRUPAL site that loads the content via AJAX.
When a user goes to the page with the form to contact me, AJAX module does not gets attached to the form.

There are two ways of getting to the page with the form.

1. Following the link on the page menu, which uses the AJAX load, in this case the form does not uses the AJAX module.
2. Loading the page directly form the browser url bar (http://www.federicojm.com/contact) in this case the AJAX module works.

Also, if the link is used and you submit the form and something does not validates, you get redirected to the form page again using DRUPAL's standard validation system, which will get the AJAX module working, cause what happens is that you get send to the URL (say http://www.federicojm.com/contact).

I'm using hook_form_alter() to add the AJAX functionality to the form

Also I'm using jQuery .load() to get the content, and what I'm loading is what comes with $content

How can I get it working?

Last thing, that is just a test site, so yes I know, it is kind of lame.

Last last thing, thanks for your help.

#1

jm.federico - September 16, 2009 - 11:30
Status:active» closed

Ok, no worries, figured it out.
I didn't know about
Drupal.attachBehaviors(targetElt);
Just calling it now and problem fixed.

THANKS

 
 

Drupal is a registered trademark of Dries Buytaert.