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

If/Else Statement + Custom Text

New Here ,
Feb 07, 2020 Feb 07, 2020

So I have this custom calc to auto populate phone numbers if a certain insurance is selected... but my insurance field is set to allow custom text for third party insurances. How do I add a code to allow for custom text to enter in a different phone number if a custom text is put in the insurance section? 

 

var fieldA = this.getField("Insurance").valueAsString;
if (fieldA=="BCBS Federal") event.value = ("1(800)442-4607");
else if (fieldA=="BCBS TX") event.value = ("1(800)451-0287");
else if (fieldA=="BCBS") event.value = ("1(800)676-2583");
else if (fieldA=="UHC") event.value = ("1(877)842-3210");
else if (fieldA=="Cigna") event.value = ("1(800)244-6224");
else event.value="";

TOPICS
How to
248
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 ,
Feb 07, 2020 Feb 07, 2020
LATEST

A calculation script is not ideal for what you want to do. It would be better if this script was in the validation or keystroke script for the dropdown. Of course you'll need to switch the field acquisition.

 

Then you can also add code to set the Read Only property of the phone field.

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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