Skip to main content
JH313
Participant
May 15, 2017
Answered

How to Change values depending on Number input on Form?

  • May 15, 2017
  • 1 reply
  • 520 views

I have a text field on my form labelled "M1" on my pdf.   The value of M1 will always be a number ranging from 1-6.

I have three additional text fields on the form labelled T1, T2 and T3.

I would like the values of T1 T2 & T3 to change, depending on what number I type in M1

For example,

If I type the number "1" in M1, i would like  T1 =1, T2 is left empty, and T3  left empty

If I type in the number "2"     T1= "1-2"      T2=left empty,      and T3 left empty.

If I type in the number "3"    T1= "1-2"       T2=3,                     and T3 left empty.

If I type in the number "4"    T1= "1-2"      T2=3-4,                     and T3 left empty.

If I type in the number "5"    T1= "1-2"      T2=3-4,                     and T3= 5

If I type in the number "6"    T1= "1-2"      T2=3-4,                     and T3= 5-6

Your help would be greatly appreciated!

This topic has been closed for replies.
Correct answer try67

I'll provide you with the first step in this code. You can extrapolate the rest from it... As the custom validation script of M1 enter this:

if (event.value=="1") {

     this.getField("T1").value = "1";

     this.getField("T2").value = "";

     this.getField("T3").value = "";

}

1 reply

Inspiring
May 15, 2017

Both Adobe and Mozilla provide free references for Acrobat JavaScript API Reference and the MDN JavaScript Reference.

JH313
JH313Author
Participant
May 15, 2017

I'm sorry, I'm very much novice at writing scripts. I think I just need the actual script.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
May 15, 2017

I'll provide you with the first step in this code. You can extrapolate the rest from it... As the custom validation script of M1 enter this:

if (event.value=="1") {

     this.getField("T1").value = "1";

     this.getField("T2").value = "";

     this.getField("T3").value = "";

}