Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Show value in one text box, with reference to value in another textbox

Participant ,
Dec 11, 2020 Dec 11, 2020

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?

TOPICS
How to , JavaScript , PDF forms
1.9K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Dec 11, 2020 Dec 11, 2020

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 = "";

 

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 11, 2020 Dec 11, 2020

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 11, 2020 Dec 11, 2020

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 11, 2020 Dec 11, 2020

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 = "";

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 17, 2020 Dec 17, 2020
LATEST

Nesa Nurani

 

Thank you very much for your help. I managed to solve this problem ... I am very grateful.

 

Hugs,

Berg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 11, 2020 Dec 11, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines