JavaScript (or JsQuery?) is not working in 1.7

Hi all,

I am currently in the process of upgrading to 1.7.  Much of it seems to be working, still some little bugs to go through.  But the big problem is that JavaScript (or maybe it's just JsQuery?) isn't working at all on the site.

Some examples of things that are not working:

  • The Tools popup menu does not appear
  • The Message and Error boxes do not disappear
  • Spotlight will not expand (well, retract, since it's open)
  • Wigdets on the Dashboard do not initialize (the graphic just keeps spinning)

What have I done?  You ask...

Upgraded from 1.6.1 to 1.7.  Disabled all plugins, upgrade.php re-enabled them, fixed the deprecated functions in my plugins.  JavaScript never worked throughout that whole process.

The rest of the site is basically functional (although not perfect, groups are still not listed, and there are some missing views that I want to fix), so I am at a lost.  Everything work with 1.6.1...

Thanks for any help :)

-I_Aritst

  • Have you checked that jQuery is being included in the html head? Have you checked that it exists on your server? Have you done the same for the elgg initialise script?

  • @Cash, thanks for the quick response,

    jQuery was previously working fine.

    the /javascript directory on the server is totally empty.

    	<script type="text/javascript" src="http://192.168.0.14/reviews/vendors/jquery/jquery-1.3.2.min.js"></script> 
    <script type="text/javascript" src="http://192.168.0.14/reviews/vendors/jquery/jquery-ui-1.7.2.custom.min.js"></script>
    <script type="text/javascript" src="http://192.168.0.14/reviews/vendors/jquery/jquery.form.js"></script>

    and the files are indeed in the vendors directory.
    I'm affraid I didn't understand what you want me to do with the initialise script. (and exactly which file you mean by that)

    Added info: clicking on "Settings" on any of the plugins in Plugin Administration does nothing.

    -I_Artist
  • If you look at the head of this page you'll see something like this:

    http://community.elgg.org/_css/js.php?lastcache=1268332316&amp;js=initialise_elgg&amp;viewtype=default



    Make sure this file is in there and that you are loading it.

  • Sorry, I hadn't realized that that line was relevant, that's why I didn't copy-paste it in the first place.

    Yes, this line is my my page source

    <script type="text/javascript" src="http://192.168.0.14/reviews/_css/js.php?lastcache=1268333227&amp;js=initialise_elgg&amp;viewtype=default"></script>

    and the file /_css/js.php exists.

    How can I make sure that I am loading it?

     

  • hit the link with your browser. Better yet, make sure you using a tool like Firebug. With that you can just view the html in the firebug window and mouse over the link and check out the source. If it is there you can put a break point in the initialise script that sets up the drop down tools menu to see that it is run and is successful.

  • If I hit the link, it loads a page showing all the JS, including

    // ELGG TOOLBAR MENU
    $.fn.elgg_topbardropdownmenu = function(options) { (....) }

    I do have FireBug installed, but I am a JS noob. I was not able to set a break in the HTML tab (where I DO see the above JS function) but I was able to create a breakpoint from the Script tab which calls the above funtion. The breakpoint was not hit. However, I may be doing something wrong.

    I appreciate your help :)

     

  • Did you check that the jQuery is being loaded (can you see the code from the jQuery script using Firebug)?

    Is javascript turned on in your browser (doesn't hurt to ask)?

    If you are not receiving any errors and your breakpoint is not being hit, that points to jQuery not being being loaded. 

    The code below setups the dropdown menu:

    <script type="text/javascript">   $(function() {   $('ul.topbardropdownmenu').elgg_topbardropdownmenu();   });   </script>

     

     

    This is inserted inline in the html page. You could insert a breakpoint here or be more old school and find the code and add a alert("In the tools init"); line inside the function() { }

  • @Cash, thank you for the time you are spending on my problem, I appreciate it.  Sorry for the delay in responding.

    In my opinion JQuery is being loaded, however I'm not sure if it is loaded correctly.  In Firebug I went to the 'Script' tab, and under that there are two more tabs 'All' and 'Site'.  'Site' lists all the JS that is loaded and there are 3 JQuery modules in there (the modules that were declared in 1.6.1), however I notice that there are new modules in 1.7 (ui-1.7.2.min and autocomplete.min) and those are not listed.

    Yes, JS is turned on.  I'm using FireFox and have my functional live site in one tab, and the buggy local site in another tab.

    As for the breakpoints not being hit, I may not have set them correctly.  Although I have many years of programming experience, I am a noob when it comes to client side programming and FireBug.

    I did try peppering alerts in the source code, nothing popped up.  But again, I can't certify that I put those alerts in the exact correct spot.

    Thank you so much for the time you spend on my account, it's much appreciated.

    -I_Artist

  • <script type="text/javascript">

    alert('Testing javascript');

    </script>

    1. Put the above code in your html body. Probably the best place is /views/default/page_elements/header_contents.php

    2. hit a page

    3. if you don't see the alert, check that the code made it into the html page

    4. if you do see the alert, javascript is working and so I would guess jQuery is not.

     

    There should be no way for this to happen on a clean install without 3rd party plugins. I'm stumped.

  • There is something wrong with JQuery. I have the same problem on a fresh installation of 1.7.

    Look here: http://community.elgg.org/mod/groups/topicposts.php?topic=449625&group_guid=12

    No idea how to deal with that, though.