Results 1 to 5 of 5

Thread: [urgent] Javascript error when adding Sugar Dashlet.

  1. #1
    jasv is offline Sugar Community Member
    Join Date
    Sep 2008
    Posts
    98

    Default [resolved] Javascript error when adding Sugar Dashlet.

    Hi, everyone.

    I'm getting a javascript error when i click on "Add Sugar Dashlet" button.

    The error says: "; expected" on this line (file include/MySugar/javascript/MySugar.js line 68):

    Code:
    var success=function(data){eval(data.responseText);
    Please i need a quick sollution for this issue.

    Thanks in advance.

    PD:
    Sugar 550a
    Sql Server 2005
    Windows XP SP3
    Last edited by jasv; 2010-08-11 at 07:24 PM. Reason: Adding extra info.

  2. #2
    jasv is offline Sugar Community Member
    Join Date
    Sep 2008
    Posts
    98

    Default Re: [urgent] Javascript error when adding Sugar Dashlet.

    Well, i have made some follow to this error. I think the error is related to the value of data.responseText.

    This value is returned from dashletsDialog function on include/MySugar/MySugar.php.

    I've been trying to check this returned string. (I'd post it here, but it's too long) but I don't even know what to look for.

    Any ideas?

  3. #3
    robertbmirth is offline Sugar Community Member
    Join Date
    Jun 2010
    Location
    Irvine, CA
    Posts
    345

    Default Re: [urgent] Javascript error when adding Sugar Dashlet.

    I haven't worked with Javascript in a long time, but your code looks like its missing a few things. I think you should try
    Code:
    var success=function(data){eval(data.responseText);};
    But... I'm not even sure why you have a function definition there... what about

    Code:
    var success= eval(data.responseText);
    That's what looks the best to me - like I said, I don't know why you have a function definition there and I haven't used javascript in a while, and I don't know what your eval function does, but that's what looks best

    And if not, well, if you're having a ';' error, that's generally not from a returned value. That generally means you're missing a ';' or some other syntax error.

  4. #4
    jasv is offline Sugar Community Member
    Join Date
    Sep 2008
    Posts
    98

    Default Re: [urgent] Javascript error when adding Sugar Dashlet.

    Hi, thank you very much for your response.

    Well, actually i didn't post all the script, here it is:

    Code:
    showDashletsDialog: function() {                                             
    			columns = SUGAR.mySugar.getLayout();
    			
    			var num_dashlets = columns[0].length;
    			if (typeof columns[1] == undefined){
    				num_dashlets = num_dashlets + columns[1].length;
    			}
    			
    			if((num_dashlets) >= SUGAR.mySugar.maxCount) {
    				alert(SUGAR.language.get('app_strings', 'LBL_MAX_DASHLETS_REACHED'));
    				return;
    			}
    			ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_LOADING'));
    			
    			var success = function(data) {		
    				eval(data.responseText);
    				dashletsListDiv = document.getElementById('dashletsList');
    				dashletsListDiv.innerHTML = response['html'];
    				
    				document.getElementById('dashletsDialog_c').style.display = '';
    				SUGAR.mySugar.dashletsDialog.show();
    				SUGAR.mySugar.dashletsDialog.configFixedCenter(null, false) ;
    
    				eval(response['script']);
    				ajaxStatus.hideStatus();
    			}
    			
    			var cObj = YAHOO.util.Connect.asyncRequest('GET', 'index.php?to_pdf=true&module='+module+'&action=DynamicAction&DynamicAction=dashletsDialog', {success: success, failure: success});			
    			return false;
    		}
    I don't think this is a javascript systax error, like you said, this is a error from the returned value. The point is that all this files (including PHP ones) are from Sugar core, I didn't touch any of them, so i guess this could be a bug. Maybe it's a database or encoding issue, i don't really know.

    Can anybody help me??

  5. #5
    jasv is offline Sugar Community Member
    Join Date
    Sep 2008
    Posts
    98

    Default Re: [urgent] Javascript error when adding Sugar Dashlet.

    Eureka!!!

    It turns that I've installed SecurityGroups plugin, wich was throwing me out a warning message ('cause the version doesn't match). I commented out this messages script (it was on a javascript code), but I didn't remove the script tags, and when an ajax call was made these tags were added to the returned string. That's it, i removed completely the javascript code and everything works fine.

    Thank you all.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. sugar dashlet issue, urgent
    By purnachandra singh in forum Developer Help
    Replies: 1
    Last Post: 2010-05-14, 02:14 PM
  2. Adding textbox with javascript
    By tyagiakhil in forum Developer Help
    Replies: 4
    Last Post: 2009-05-25, 01:19 PM
  3. Replies: 1
    Last Post: 2007-03-20, 07:16 PM
  4. Replies: 0
    Last Post: 2006-11-20, 10:19 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •