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

How to get a textfield to return a specific word based on numeric value of another field

New Here ,
Nov 05, 2018 Nov 05, 2018

Copy link to clipboard

Copied

HI all - apologies in advance, I'm a complete laymen when it comes to JS. I've searched high and low for the answer, but I worry that I don't know how to phrase the question to find the right answer.

In short, I have a form that will have three figures manually entered into three different fields. A fourth box will run Adobe built-in code to sum three other fields. I then have a fifth text field. I'm having trouble with the fifth field. I want it to look at the sum total of the fourth field and depending on the value, return the words "Low", "Medium", or "High". From my first image below, you'll see this will then be repeated for "Simple", "Intermediate", and "Complex". Each half of this form will determine Seriousness and Complexity.

I've only worked on the Seriousness side at this stage. If the value is 0-5, I want to return "Low", 6-10 "Medium", and 11+ "High". The second image is the script I've been trying to use. I've seen multiple variations of different ways, but none of them seem to work. I don't even know which part I should be placing it. I've mostly been trying to put it in "Run custom validation script" under the Validate Tab - but also tried "Custom calculation script" under Calculate.

Thanks heaps - Mike.

pic1.png

pic2.png

TOPICS
Acrobat SDK and JavaScript

Views

181

Likes

Translate

Translate

Report

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 ,
Nov 05, 2018 Nov 05, 2018

Copy link to clipboard

Copied

I should have added this in my main post, but I'm aware this code is incomplete to do what I want it to. I was just trying to get the "Low" to show up first before developing it further.

Likes

Translate

Translate

Report

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
LEGEND ,
Nov 22, 2018 Nov 22, 2018

Copy link to clipboard

Copied

LATEST

The variable "srstotal" is only the field oject. You need to and ".value" to obtain the value of the field object.

Likes

Translate

Translate

Report

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