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

Text field question

New Here ,
Apr 03, 2017 Apr 03, 2017

HI,

I'm not sure what the proper etiquette is when asking questions. but here is what I want to do. When a number (this time a measurement) is entered in a text field (field_01) I would like a predetermined number to show up in another text field (field_02). The problem is the number in text field 1 would have to be between, for example greater that 50 and less than 100. Meaning when all numbers between 50 and 99 are entered in field 1 number is generated in field 2. And if a number is put in field 1 lets say, between 100 and 150, a different number is generated in field 2.

I hope this is making sense. I added a graphic. thanks so much.

example_01.png

TOPICS
Acrobat SDK and JavaScript
274
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 ,
Apr 03, 2017 Apr 03, 2017

You need to use conditional logic to do that: https://acrobatusers.com/tutorials/conditional-execution

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 ,
Apr 03, 2017 Apr 03, 2017

The basic code would be something like this (used as the custom calculation script of field_02):

var v1 = Number(this.getField("field_01").value);

if (v1>=50 && v1<=100) event.value = "22";

else if (v1>100 && v1<=150) event.value = "44";

else event.value = "";

I used dummy values since you didn't specify what you actually want it to be...

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 ,
Apr 03, 2017 Apr 03, 2017
LATEST

It worked. You have been so nice answering my silly questions. thank you so much.

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