Skip to main content
waelk38411626
Known Participant
January 8, 2020
Question

auto populate field from drop down list

  • January 8, 2020
  • 1 reply
  • 1970 views

Hello, I created a drop-down list and a text field, I automatically fill in according to the list but sometimes I need to modify the text in the text field, I can't;
for example the ZCQJ006 can be 70 and can be 80 and sometimes even 85, please help

drop-down = NGAPCCAM       text field1 = paiement   text field2 = Somme

javascript = 

var f = this.getField("NGAPCCAM");

var g = this.getField("paiement");

if ((f.valueAsString=="ZCQJ006") && (g.valueAsString == "CMU")) {this.getField("Somme").value = "70"; 

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
January 8, 2020

Is this a calculation script? And on which field is it located?

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
waelk38411626
Known Participant
January 8, 2020

yes calculation script

drop down liste = NGAPCCAM

field 1 = paiement 

field 2 = Somme

if i choose ZCQJ006 in the drop down list 

and I chosse CMU in the field 1

i get the Somme auto filed in the field 2  by the number 70 

but I need sometimes another number like 80 or 85 in the Somme

try67
Community Expert
Community Expert
January 8, 2020

You can duplicate the last line of code with the new values you want to test.