1

I've got a fillable PDF form my client is using for taking orders. It includes a chart with various fields and multiple rows that all end in a "Subtotal" field. I want to automatically calculate this subtotal field so that the user does not have to punch in the currency themselves.

The value of that field needs to be based off of another field. The user fills in this other field with the total quantity they want. I need to automatically take the quantity they enter and multiply it by a price that I set myself.

How can I do this using javascript in Adobe Acrobat?

jkupczak
  • 2,891
  • 8
  • 33
  • 55

1 Answers1

2

youll have to do something like this

this.getField("total").value = this.getField("filed1").value + this.getField("filed2").value;
Mike
  • 3,017
  • 1
  • 34
  • 47
  • Thanks for that, here's my working code based on what you posted. `this.getField("Total Cost 01").value = this.getField("Number of Dancers 01").value * this.getField("Cost Per Dancer 01").value;` My only problem is that now the "Total Cost" field automatically enters a value of $0.00 before any quantity is entered. Can I get it to remain blank until "Number of Dancers" (my quantity field) actually has a value? – jkupczak Jan 29 '12 at 19:53
  • add a condition like `if (this.getField("Number of Dancers 01").value!= '' && this.getField("Number of Dancers 01").value!= null) { your code }` – Mike Jan 29 '12 at 20:00
  • See this http://stackoverflow.com/a/2281671/1168944 also for javascript variable validation. – Mike Jan 29 '12 at 20:17