javascript 如何使用javascript根据另一个文本字段的内容自动计算Adobe Acrobat中文本字段的值?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9055905/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to automatically calculate the value of a text field in Adobe Acrobat with javascript based on the contents of another text field?
提问by jkupczak
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.
我有一个可填写的 PDF 表格,我的客户正在使用它来接受订单。它包括一个具有各种字段和多行的图表,这些行都以“小计”字段结尾。我想自动计算这个小计字段,这样用户就不必自己打入货币了。
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?
如何在 Adobe Acrobat 中使用 javascript 执行此操作?
回答by Mike
youll have to do something like this
你必须做这样的事情
this.getField("total").value = this.getField("filed1").value + this.getField("filed2").value;