Form JavaScript help needed: Need to get value of a field (SCORE) and return text (PASS/FAIL)
I do not have any JavaScript experience and am hoping that someone can assist me with a Adobe form calculation.
I am creating a Pass/Fail scorecard that will take a value from a field (Calc_OScore) and then return a word (Perfect!, Pass, Fail) based on the score.
Due to my lack of experience and ignorance, my attempts to make this work have been nothing more than copy/paste trial and error from others' scripts and experiences.
I've tried this:
var text ;
if ("Calc_Score" == 16) {
text = "PERFECT!!";
} else if ("Calc_Score" > 11) {
text = "PASS";
} else {
text = "FAIL";
}
And one of these:
var int1=this.getField("E_score").value;
var int2=this.getField("S_score").value;
var int3=this.getField("P_score").value;
var int4=this.getField("C_score").value;
var tSum = Number(int1+int2+int3+int4);
var rVal = 'NULL';
if(tSum===16){
rVal='PERFECT SCORE!';
}else if(tSum>11){
rVal='NOT PERFECT BUT OKAY!';
}else{
rVal='FAIL';
}
return rVal;Can anyone help out here? If it makes it easier to understand what I'm trying to accomplish, here's what my formula in Excel looked like: =IFS(F31=16,"PERFECT!",F31>11,"PASS",TRUE,"FAIL"), where "F31" is now "Calc_OScore".
I appreciate and welcome all feedback!
