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

Auto Fill two fields depending on text in another field

New Here ,
Feb 01, 2017 Feb 01, 2017

Working with Adobe Acrobat Pro DC

I am trying to fill two other text fields with different information depending on what is entered into a third text field.  Here is the script I put together, but it is not working.  I have tried to set it to Select Trigger: Mouse Up and Mouse Enter also.  Any suggestions?

var v = event.target.value;

var f4 = this.getField("Days available");

var f5 = this.getField("Pay Level");

if (v != "1") {

    f4.value = "3";

  f5.value = "1";

   

}

else if (v != "2") {

    f4.value = "4";

  f5.value = "1";

   

}

else if (v != "3") {

    f4.value = "5";

  f5.value = "2";

   

}

else if (v != "4") {

    f4.value = "6";

  f5.value = "3";

TOPICS
Acrobat SDK and JavaScript , Windows
553
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

correct answers 1 Correct answer

LEGEND , Feb 01, 2017 Feb 01, 2017

What exactly is happening when you enter a value?

Did you check the Acrobat JavaScript console for any errors?

What do you want to happen if none of the expected values is entered?

I would consider using the equality operator and not the no equal operator.

Translate
LEGEND ,
Feb 01, 2017 Feb 01, 2017

What exactly is happening when you enter a value?

Did you check the Acrobat JavaScript console for any errors?

What do you want to happen if none of the expected values is entered?

I would consider using the equality operator and not the no equal operator.

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 ,
Feb 01, 2017 Feb 01, 2017
LATEST

Sorry, I am very new to writing scripts.  As soon as I select the text field it puts 3 and 1 in the other fields.  If I enter another number then nothing happens.

Where do I find the JavaScript console?

Sorry I had added the following at the end for when there was something else put in the field and forgot to put that in original post.

else {

    f4.value = "0";

  f5.value = "0";

  

}

Thank you for pointing out the no equal operator.  That appears to have been my problem, thank you very much for your help for such a silly problem.

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