Jump to content

chinadoug

Member
  • Posts

    1
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

About chinadoug

chinadoug's Achievements

0

Reputation

  1. I have noticed that the excludorIsChecked function in check.js does not seem to check whether an option is actually being shown on the screen when it tries to exclude it. This causes javascript errors. The current logic seems to be as follows: Function is called with an item number and the function is suppose to tell whether that item should be excluded or not. That item is the excludee. So we loop through every item that exists. For each item in the loop we check whether it has an exclusion list and if so we see whether our excludee is in that list. If our excludee is in the list, we check whether the loop item is checked. If the loop item is checked, we return true indicating that the excludee's excludor is checked. Boy that is confusing to state. ---- Okay. That is my understanding of the function. My problem is sometimes and item will be listed in the exclusion list of a potential excludor whose cond value is false meaning that it isn't being displayed. When this function goes to check whether this potential exludor is checked, an error is thrown because the object does not exist. This means, I think, that there should be a check for all potential excludors in this function to see whether they actually are being displayed. I modified the function as follows (my additions are in bold), which seems to fix the problem but I would like to see if others agree and I don't know how to submit this to be put in the next version of WPI so I decided to post here. function excludorIsChecked(i) { position="check.js"; whatfunc="excludorIsChecked()"; var j, k; for (j=1; prog[j]; j++) //run through all progs { if (cond[j] && cond[j][0]) { var c = unescape(ReplacePath(cond[0]).replace(/\\/g, "\\\\")); try { if (!eval( c ) continue; } catch(e) { alert(getText(ErrorInCondStatement)+"\n\n" + prog + "\n" + cond + "\n\n"+getText(TreatingAsFalseCond)); continue; } } for (k=0; excl[j] && k<excl[j].length; k++) //run through all exclusions of prog[j] { if (uid && uid==excl[j][k]) { //find parent's checkbox var elem = document.getElementById("chkbox"+j); if (elem.checked) return true; } } } return false; }
×
×
  • Create New...