Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - TypeError "is undefined"
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

TypeError "is undefined"

 Post Reply Post Reply
lindaelise View Drop Down
New Member
New Member

Joined: 26 Mar 2014
Points: 19
Post Options Post Options   Quote lindaelise Quote  Post ReplyReply Direct Link To This Post Topic: TypeError "is undefined"
    Posted: 23 Feb 2015 at 8:29pm

I'm hoping someone can help me with a problem I am having with some code I am writing. 

I am getting a TypeError: "is undefined" with the following code:

var srchIndxArr = new Array();

var counter = 0;
for (var i=1; i<global.sV.length; i++) {
  if (typeof global.sV=="undefined") continue;
  t.value = i;
  if (global.sV.sT!=null && global.sV.sT!="") {
   for (var j in global.sV.sP) {

      var matchesCounter = 1;
      var sP = global.sV.sP[j];
      var mT = global.sV.mT;
      var m = global.sV.m;
     //var pR = sPA(global.mainDoc, sP, mT, m, [59,170.0919952392578,594.5,110.5]);
      for (var k in global.sV.results) {      

       var xxx = global.sV.results[k].index;
       if (srchIndxArr.indexOf(xxx)!=-1) {
        if (matchesCounter > 1){
         //console.println("no" + matchesCounter);

         } else {
         //console.println("yes" + matchesCounter);

         var pR = sPA(global.mainDoc, sP, mT, m, [59,170.0919952392578,594.5,110.5]);
       matchesCounter = matchesCounter + 1;
       } else {
       // nothing
         global.sV.results = global.sV.results.concat(pR);



The code in red is what is causing the problem.  Strangely enough, if I moved the code to the location of the green code it does not give me the "is undefined" TypeError.   I want the code to be in the red location because I want variable pR only when matchesCounter is "1" and not more than one.

I've tried moving the code around to see if it made a difference but had no luck. 

I have noticed that putting one "for in" statement inside another "for in" statement seems to cause the problem but I'm wondering if there is more to it than that. The "for in" statements are the following:  "for (var j in global.sV.sP) {"  and " for (var k in global.sV.results) { ".




Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.063 seconds.