Copy link to clipboard
Copied
Hi,
I need help.
I am preparing a training evaluation form where for each item to be evaluated I have the following values:
4 - Very good
3 - Good
2 - Regular
1 - Bad
I inserted a check box to select the options and a text box to show me the average of the overall evaluation.
With the value of this average, I wanted it to appear in another text box, the values: Very good, Good, Regular or Bad, referring to the value of the average found.
How do I do that?
Copy link to clipboard
Copied
You can try like this.
var avg = this.getField("Average").value;
if(avg >= 1 && avg < 2){
event.value = "Bad";}
else if(avg >= 2 && avg < 3){
event.value = "Regular";}
else if(avg >= 3 && avg < 4){
event.value = "Good";}
else if(avg == 4){
event.value = "Very good";}
else event.value = "";
Copy link to clipboard
Copied
Use this in field where you want to show text:
var avg = this.getField("Average").value;
if(avg == 1){
event.value = "Bad";}
else if(avg == 2){
event.value = "Regular";}
else if(avg == 3){
event.value = "Good";}
else if(avg == 4){
event.value = "Very good";}
else event.value = "";
Rename field name if neccessary.
Copy link to clipboard
Copied
Thanks a lot for the help.
And if I want to reference it as follows:
1 to 1.9 - Bad
2 to 2.9 - Regular
3 to 3.9 - Good
4 is very good
How do I put this in the Javascript code
Hugs,
Berg
Copy link to clipboard
Copied
You can try like this.
var avg = this.getField("Average").value;
if(avg >= 1 && avg < 2){
event.value = "Bad";}
else if(avg >= 2 && avg < 3){
event.value = "Regular";}
else if(avg >= 3 && avg < 4){
event.value = "Good";}
else if(avg == 4){
event.value = "Very good";}
else event.value = "";
Copy link to clipboard
Copied
Nesa Nurani
Thank you very much for your help. I managed to solve this problem ... I am very grateful.
Hugs,
Berg
Copy link to clipboard
Copied
Seizing the opportunity. I am very interested in learning Javascript for Adobe forms.
Would you point me somewhere (website, Youtube channel, etc.) where you have any courses or javascript tutorials for Adobe forms?
I thank you in advance for your attention.
Hugs,
Berg
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more