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

How do I make a number, within a set ranges, in one field determine the value of another?

New Here ,
Oct 04, 2021 Oct 04, 2021

Hello,

 

I am not familiar with java script but this is what I’m trying to achieve. If I type a single to 3-digit value in form field "A" I want a predetermined value to appear in form field "B." Where the value in form field "A" lands deternines the value displayed in form field "B." My ranges are 900-750 = 3, 749-700=2, 699-660=1, 659-640=0, 639-0=-1.

 

I know how to write this formula in Excel. In cell "B1" type =IF(A1>749, 3, (IF(A1>699, 2, (IF(Cell>659, 1, (IF(A1>639, 0, -1))))))). This works great but I need the form in a PDF not Excel. 

 

Thank you for any help you can give me. 

TOPICS
Edit and convert PDFs , How to , JavaScript , PDF forms
987
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 ,
Oct 04, 2021 Oct 04, 2021

As Validation script of field "A" use this:

var f = this.getField("B");
if(event.value >= 0 && event.value <= 639)
f.value = -1;
else if(event.value >= 640 && event.value <= 659)
f.value = 0;
else if(event.value >= 660 && event.value <= 699)
f.value = 1;
else if(event.value >= 700 && event.value <= 749)
f.value = 2;
else if(event.value >= 750 && event.value <= 900)
f.value = 3;

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 ,
Oct 04, 2021 Oct 04, 2021

As Validation script of field "A" use this:

var f = this.getField("B");
if(event.value >= 0 && event.value <= 639)
f.value = -1;
else if(event.value >= 640 && event.value <= 659)
f.value = 0;
else if(event.value >= 660 && event.value <= 699)
f.value = 1;
else if(event.value >= 700 && event.value <= 749)
f.value = 2;
else if(event.value >= 750 && event.value <= 900)
f.value = 3;

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
New Here ,
Oct 05, 2021 Oct 05, 2021
LATEST

Thank you so much! This worked like a charm. 

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