By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,176 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

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

Claus Mygind
100+
P: 571
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:

Expand|Select|Wrap|Line Numbers
  1. function StartSmallSearchResult(cWhichClient, cIsJob) {
  2.  
  3.     if (cIsJob)
  4.     {
  5. /*
  6. when this condition is commented out then there is no problem.
  7. 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.
  8. In these 3 apps. this function is called.
  9.  
  10. I have a 4th app. where this function is not called, but the "if (cIsJob)" condition causes other function calls to fail.
  11.  
  12. I have also tried
  13. if (cIsJob == true), but that does not work either.
  14.  
  15. 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.
  16. */
  17.         var cJobOrGeoTech = true;
  18.     }else
  19.         var cJobOrGeoTech = false;
  20.     }
  21.     if (cWhichClient=="ComContact")                              
  22.     {                                                     
  23.         var cId = f1.COMID.value; 
  24.     }else{                              
  25.         var cId = f1.ID.value;      
  26.     }
  27.     var cWidth  = 450;       
  28.     var cHeight = screen.availHeight;     
  29.     CenterWindow( cHeight, cWidth);
  30.     smallSearchWindow =window.open('SmallSearchResult.exe?SEARCH='+cId+'&FieldName='+cWhichClient+'&isJobOrGeoTech='+cJobOrGeoTech+'&SearchId=yes&SETMODE=No',
  31.         'SmallsearchWindow',
  32.         windowFeatures);
  33.  
  34.     smallSearchWindow.focus(); 
  35.     return false;               
  36. }
  37.  
Aug 18 '08 #1
Share this Question
Share on Google+
1 Reply


Claus Mygind
100+
P: 571
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.
Aug 18 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.