Question

I am getting the following Javascript error when clicking on the List tab in the SP2010 ribbon for a Project Task list that I have placed into a webpart on the default.aspx page:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.3) Timestamp: Tue, 5 Jul 2011 20:32:33 UTC

Message: 'projectTaskButtonAppName' is undefined Line: 1302 Char: 9 Code: 0 URI: http://sptest/_layouts/sp.ribbon.debug.js?rev=lc6eCMZP6gL5LnuSYh0S6Q%3D%3D

I have searched quite extensively and have not found any other complaints..

Does anyone have any idea what I can check? I do not have MS Project on my machine, but surely that wouldn't break the JS.

Was it helpful?

Solution 4

I solved the problem by adding a try catch to the JS that was breaking. I made the following change to SP.Ribbon.debug.js: Line 1302-

    try{    
    return !eval($v_0.HiddenScript);
    }
    catch(e){
    return true;
    }

Now the ribbon buttons are at least usable. I think I'll have to make this same change in SP.ribbon.js .

Perhaps this is due to me not having MS Project installed on my box.

Anyway hope this helps some other poor soul as well.

OTHER TIPS

The Ribbon icons are grayed out but still Active/useable. If you click elsewhere, they tend to come back to life with color. Appears to be a SP Bug/scripting error that has a workaround.

I had the same problem with my project task list. In order to get rid of this problem i tested different web part settings for project task list. The option that worked for me was setting Toolbar type to: Full Toolbar.

I tried to hide 'New link' on List/Library View by set the List View WebPart's Toolbar property to "No Toolbar" and I got this Error. Then I found different approaches listed below.

Before that, please change the required Webpart's Toolbar Property back to "Summary Toolbar".

Approach 1 (Simple)

In common js file, which you used in the site (Or Create New JS file, upload it in Assets Library and give reference in your site Master Page) add the below code. This will simply create a empty div and add it to the page. It Works!

<script type="text/javascript" language="javascript">
    var elemDivTaskButton = document.createElement('div');
    document.body.appendChild(elemDivTaskButton);

    var projectTaskButtonAppName = (typeof projectTaskButtonAppName === 'undefined') ? elemDivTaskButton : projectTaskButtonAppName; 
</script>

Approach 2

  1. Create a HTML file with below code and upload it in SiteAssets Library.
  2. Edit the 'AllItems.aspx' page of the List (or required page where the list view added) and Add a Content Editor WebPart (CEWP).
  3. Edit the Content Editor WebPart and in "Content Link" property (On WebPart properties Panel) specify the above HTML file URL. Click 'Ok'.
  4. In 'Page' tab on Top Ribbon, click "Stop Editing". Now check the Page. The JS Error should be gone.

        //Invoke HideNewItemLinkAndActviateWP Method after PageLoad.
        _spBodyOnLoadFunctionNames.push("HideNewItemLinkAndActviateWP");
    
        function HideNewItemLink()
        {
            try
            {
                HideNewItemLink('Hero-WPQ2');
                SetWebPartActive('MSOZoneCell_WebPartWPQ2');
            }
            catch(err)
            {
                //Handle errors here
            }
        }
    
        function HideNewItemLink(tblId)
        {
            try
            {
                var tblNewItemLink = null;
                tblNewItemLink = document.getElementById(tblId);
                if(tblNewItemLink != null)
                {
                    tblNewItemLink.style.display='none';
                }
            }
            catch(err)
            {
                //Handle errors here
            }
        }
    
        function SetWebPartActive(wpId)
        {
            setTimeout(function() {
                var webPart = document.getElementById(wpId);
                if(webPart != null) {
                    var dummyEvent = new Array();
                    dummyEvent["target"] = webPart; 
                    dummyEvent["srcElement"] = webPart; 
                    WpClick(dummyEvent);
                    }
            }, 200)
        }
    

I've notice this issue occurs when you change the Toolbar.Type from "Standard" to "None" on the XsltListViewWebPart

Try adding a Content Editor webpart and add the code there as given in the first approach -

<script type="text/javascript" language="javascript">
    var elemDivTaskButton = document.createElement('div');
    document.body.appendChild(elemDivTaskButton);

    var projectTaskButtonAppName = (typeof projectTaskButtonAppName === 'undefined') ? elemDivTaskButton : projectTaskButtonAppName; 
</script>
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top