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

IfText1 is between a range of number, then enter this into Text2

Explorer ,
Jul 06, 2022 Jul 06, 2022

Copy link to clipboard

Copied

I work for a financial institution and I'm trying to create a form for our automatic payments. If Text1 (aka the loan number) is beween 0800 and 0899 OR 8000 and 8999 OR 0900 and 0999 OR 9000 and 9999 then I need Text2 to be visible and say "Variable Rate Payment".

 

defaultrfjue3aoi30b_0-1657119393392.png

 

TOPICS
Create PDFs , Edit and convert PDFs , General troubleshooting , How to , JavaScript , PDF forms

Views

422

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

correct answers 1 Correct answer

Community Expert , Jul 11, 2022 Jul 11, 2022

OK, then you can use this code as the custom Calculation script of Text2:

 

var v = Number(this.getField("Text1").valueAsString);
if ((v>=800 && v<=899) || (v>=8000 && v<=8999) || (v>=900 && v<=999) || (v>=9000 && v<=9999))
	event.value = "Variable Rate Payment";
else event.value = "";

Votes

Translate

Translate
Adobe Employee ,
Jul 08, 2022 Jul 08, 2022

Copy link to clipboard

Copied

Hi there

 

Hope you are doing well and sorry to hear that.

 

The workflow you are trying to achieve is possible using JavaScript. For more information please check the help pages listed below:

https://acrobatusers.com/tutorials/javascript_console/

https://helpx.adobe.com/acrobat/using/applying-actions-scripts-pdfs.html

 

Hope it will help

 

Regards

Amal

Votes

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
Community Expert ,
Jul 08, 2022 Jul 08, 2022

Copy link to clipboard

Copied

And if it's not?

Votes

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
Explorer ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

If it's not one of those numbers or any in between then I need Text2 to just be blank.

Votes

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
Community Expert ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

OK, then you can use this code as the custom Calculation script of Text2:

 

var v = Number(this.getField("Text1").valueAsString);
if ((v>=800 && v<=899) || (v>=8000 && v<=8999) || (v>=900 && v<=999) || (v>=9000 && v<=9999))
	event.value = "Variable Rate Payment";
else event.value = "";

Votes

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
Community Expert ,
Jul 08, 2022 Jul 08, 2022

Copy link to clipboard

Copied

Be sure that it uses a "Number" format and place this script as a validation script in Text1:

 

var oFld = this.getField("Text2");
if ((event.value >= 800 && event.value <= 899) || (event.value >= 8000 && event.value <= 8999) || (event.value >= 900 && event.value <= 999) || (event.value >= 9000 && event.value <= 9999)) {
oFld.value = "Variable Rate Payment";
oFld.display = display.visible;
}
else {
oFld.value = oFld.defaultValue;
oFld.display = display.hidden;
}

Votes

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
Explorer ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

It doesn't appear that this is actually doing anything. It's not showing or hiding the box, and it's not putting in the text. I have entered the formula in the "run custom validation script" box on the validate tab. It's not giving me an error or anything - it's just not working. Any suggestions?

Votes

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
Community Expert ,
Jul 12, 2022 Jul 12, 2022

Copy link to clipboard

Copied

LATEST

Can you share (part of) this document?

Votes

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