Hello im a neewbie in acrobat and i need to create a form whit conditional execution for the "total" sum of the fields
the code i´ve created is this:
var ReqVal = this.getField("TRequerimento").value;
var Sum1 = this.getField("TP1").value;
var Sum2 = this.getField("TP2").value;
var Sum3 = this.getField("TP3").value;
var Sum4 = this.getField("TP4").value;
var Sum5 = this.getField("TP5").value;
var Sum6 = this.getField("TP6").value;
var SumT = Sum1 + Sum2 +Sum3 + Sum4 + Sum5 + Sum6;
if ( ((ReqVal == 1) || (Reqval == 5)) && (SumT < 100) )
event.value = 100;
else if ( (ReqVal == 2) && SumT < 200 )
event.value = 200;
else if ( ((ReqVal == 3) || (ReqVal == 4)) && (SumT < 150) )
event.value = 150;
else
event.value = SumT;
the problem is that it only calculate the first value (100) and don´t continue making the counts.
this script is inserted in the "total" text field
Can you help me thanks in advance
JM
Look carefully at the line that reads "if ( ((ReqVal == 1) || (Reqval == 5)) && (SumT < 100) )", where is "Reqval" declared?I would look at using the "switch" statement and not the "if" statement for complex decision statements.
George Kaiser