Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7502207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:47:06+00:00 2026-05-29T20:47:06+00:00

I am in the process of migrating my Drupal 6 site to Drupal 7.

  • 0

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.

<? php
 $form['status_list'] = array(
'#type' => 'select',
'#title' => t('Freeway Project Statuses'),
'#options' => array(
  0 => t('-Select Status-'),
  1 => t('Draft'),
  2 => t('NotSpecified'),
  3 => t('Quote'),
  4 => t('Forecasted'),
  5 => t('InEvaluation'),
  6 => t('Cancelled'),
  7 => t('Booked'),
  8 => t('InProduction'),
  9 => t('Completed'),
  10 => t('Closed'),
 ),
 '#default_value' => array('0' => 'Select Status'),
 '#weight' => 0,
);

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.

      (function$){
    $(document).ready(function () {
     $("#edit-status-list").change(function() {
     var selectedStatus = $(this).find(":selected").text();
     var charExists = ((window.location.href).indexOf('?') >= 0) ? true : false;

    if(charExists){
    var split = (window.location.href).split('?');
    var loc = split[0];

      loc = loc+"?status="+selectedStatus;  
    self.location.href= loc;

    }

    else{
     var locf = window.location.href+"?status="+selectedStatus;   
     self.location.href= locf;

     }

     });

     $("#create-freeway-project").submit(function() {
      $(":submit", this).attr("disabled", "disabled");

     });

    $(".common_link_class").click(function() {
          //alert("Hello");

       var count = ($(this).data("clicks") || 0) + 1;
       $(this).data("clicks", count);


        if ($(this).data("clicks") >= 1) {

       }


       if ($(this).data("clicks") >= 2) {

         return false;
       }
     });


      $("#edit-analysis-code-one").change(function () {
        // Get the configs and split them.
        var cfgs = _get_configs("edit-custRef");
        var split_cfgs = cfgs.split('/');

        // Create some new configs and put it back into the configs  textfield.
        //var new_cfgs = $(this).val() +"/"+ cfgs[1];
        var new_cfgs = $("#edit-analysis-code-one option:selected").text() +"/"+ cfgs[1];

        $("#edit-custRef").val(new_cfgs);
      });

      $("#edit-analysis-code-two").change(function () {
        // Get the configs and split them.
        var cfgs = _get_configs("edit-custRef");
        var split_cfgs = cfgs.split('/');

        // Create some new configs and put it back into the configs textfield.
        //var new_cfgs = cfgs[0] +"/"+ $(this).val();
        var new_cfgs = cfgs[0] +"/"+ $("#edit-analysis-code-two option:selected").text()
        $("#edit-custRef").val(new_cfgs);
     });


   });

 })(jQuery); 


(function$){
function _get_configs(id) {

  return $("#"+ id).val();

}   
})(jQuery); 

#edit_status_list is the dropdown of our interest.

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:47:08+00:00Added an answer on May 29, 2026 at 8:47 pm

    It should be

    (function($) {
    

    Not

    (function$ {
    

    What you’ve got is a syntax error. The first one instantiates a function such that its first argument will be available via the symbol $ in its body code. The function is invoked after the body:

      // ...
    })(jQuery);
    

    and the global “jQuery” object is passed in as the argument. This setup assures your code access to the correct framework (that is, to jQuery) via the common “$” symbol without having to worry about another external binding for “$”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm in the process of migrating some of our old code into Java and
I am in the process of migrating some legacy code to LINQ to SQL
We are in the process of migrating our ASP.NET application to use Jquery instead
I'm in the process of migrating some databases. I have this table that has
I am attempting to migrate hosts and am having issues migrating from one Drupal
I am in process of migrating my old domain to new domain using Apache
We're in process of migrating one stable project from Castle Windsor 2.5.2 to 3.0.
We are in the process of migrating our bug tracking to Bugzilla from a
I am in the process of migrating from a Django FastCgi setup in Apache
I am in the process of migrating an existing webserver running IIS 6 to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.