Skip to main content
waelk38411626
Known Participant
Jan 8, 2020 8:50 PM UTC
Question

auto populate field from drop down list

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 is closed to new replies. Start a new post to keep the conversation going.

14 replies

Thom Parker
Community Expert
Community Expert
Jan 8, 2020 8:57 PM UTC

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

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
waelk38411626
Known Participant
Jan 8, 2020 9:04 PM UTC

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

Translate
try67
Community Expert
Community Expert
Jan 8, 2020 9:15 PM UTC

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

Translate