Expand my Community achievements bar.

If statement not executing from variable.

Avatar

Level 1

I have a form that once filled in creates a document based on the users input. For some reason, the if statement are not reading the variable to select the proper event to execute. The same if statements are used in other parts of the document to spawn the required pages and work perfectly. I can not find any problems in the code and the debugger shows ReferenceError: tr1 is not defined. 2:Field:Calculate.The problem is with variable" tr1, tr2 . Thank you for any help / advice you may have

 

if ((hppn.value !== "")&&(h2s.value !== "")){

// Jumbo Injection Trailer, T-Trailer & 407 Chemical Trailer Deployed;
if ((tr1.value > 0)&&(tr2.value > 0)&&(tr3.value > 0)){
event.value = "Statement 1";
}

// Jumbo Injection Trailer & 407 Chemical Trailer Deployed;
if ((tr1.value > 0)&&(tr2.value === 0)&&(tr3.value > 0)){
event.value = "Statement 2";
}

// Jumbo Injection Trailer and T-Trailer Deployed;
if ((tr1.value > 0)&&(tr2.value > 0)&&(tr3.value === 0)){
event.value = "Statement 3";
}

// Jumbo Injection Trailer Deployed;
if ((tr1.value > 0)&&(tr2.value === 0)&&(tr3.value === 0)){
event.value = "Statement 4";
}

// 407 Chemical Traile(s) deployed;
if ((tr1.value === 0)&&(tr2.value === 0)&&(tr3.value > 0)){
event.value = "Statement 5";
}

// T-Trailer(s) deployed;
if ((tr1.value === 0)&&(tr2.value > 0)&&(tr3.value === 0)){
event.value = "Statement 6";
}
}

0 Replies