subroutine interfering; causing functions in .js file to fail.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Claus Mygind
    Contributor
    • Mar 2008
    • 571

    subroutine interfering; causing functions in .js file to fail.

    I have a number of common routines stored in one .js file which I load with all my apps. I was making changes to one of the functions in this file. And it works great for the apps that use this function. However another app which does not even call this function causes any function call located in this file to fail. The error message I get is "... is not defined". where ... is any function in the .js file.

    Using Firebug, I can see that the .js file has been loaded, so I was just wondering how this can happen? And what can I do to resolve the problem.? Here is the code:

    Code:
    function StartSmallSearchResult(cWhichClient, cIsJob) {
    
    	if (cIsJob)
    	{
    /*
    when this condition is commented out then there is no problem.
    The cIsJob is a parameter that may or may not be passed. I have two apps. where it is passed and one app. where it is not, where everything works fine.
    In these 3 apps. this function is called.
    
    I have a 4th app. where this function is not called, but the "if (cIsJob)" condition causes other function calls to fail.
    
    I have also tried
    if (cIsJob == true), but that does not work either.
    
    I can leave the results of the if condition in the function and that is not a problem.  It is only the if condition that creates the problem.
    */
    		var cJobOrGeoTech = true;
    	}else
    		var cJobOrGeoTech = false;
    	}
    	if (cWhichClient=="ComContact")                              
    	{                                                     
    		var cId = f1.COMID.value; 
    	}else{                              
    		var cId = f1.ID.value;      
    	}
    	var cWidth  = 450;       
    	var cHeight = screen.availHeight;     
    	CenterWindow( cHeight, cWidth);
    	smallSearchWindow =window.open('SmallSearchResult.exe?SEARCH='+cId+'&FieldName='+cWhichClient+'&isJobOrGeoTech='+cJobOrGeoTech+'&SearchId=yes&SETMODE=No',
    		'SmallsearchWindow',
    		windowFeatures);
    
    	smallSearchWindow.focus(); 
    	return false;               
    }
  • Claus Mygind
    Contributor
    • Mar 2008
    • 571

    #2
    Just as I posted this, I found the error. A missing { in the "}else". So no help is needed. Just frustrated it took me 1hr. to spot the missing {

    Odd how the problem did not appear in the apps that actually used this function.

    Comment

    Working...