Hi All,
I am in the process of migrating my Drupal 6 site to Drupal 7. As a result i am facing some issues with the code.
The calling of javascript laced with jquery etc is different in Drupal 7 is what i have read.

This is the image of the page i had in Drupal 6.

On change of the dropdown box, the table above it gets populated with projects belonging to that status. This works fine in Drupal 6.

But in Drupal 7 i see this javascript error

This is the form element for the Dropdown in my php file.

And this is the JavaScript

i have modified it with the additional tags for Drupal 7 (function$){ .. })(jQuery); . These tags were not needed in Drupal 6.

Would like to have your suggestions as to what additional change needs to be done for proper javascipt calling in Drupal 7

Comments

jaypan’s picture

(function($)
{
  // code goes here
}(jQuery));

And in Drupal, you don't use $(document).ready(), you use Drupal.behaviors. Doing it your way bypasses the Drupal APIs, which can cause unexpected behaviors, and prevent 3rd party modules from working correctly.

Contact me to contract me for D7 -> D10/11 migrations.

angela.simmons’s picture

Thanks Jay the error for javascript throwing error was resolved thanks to this. But the Jquery method is not reflecting. I will raise a new question for the same

angela.simmons’s picture

Hi,
I would like to have your views on this associated doubt of mine.
http://drupal.org/node/1438884

Thanks
Angie

infinitymultimedia’s picture

Thanks for the code this helped me solve an issue with the Aino Galleria. The initialize galleria code placed before the closing body tag, required this piece of code in order for it to be recognised correctly.

angela.simmons’s picture

I am glad that this post was of help to you.