简体   繁体   English

值未在表单上更新

[英]Value not being updated on form

I am using Adobe Acrobat DC Pro and I am using the javascript console to do an update to the "default value" of a number of fields. 我正在使用Adobe Acrobat DC Pro,并且正在使用javascript控制台对许多字段的“默认值”进行更新。 The following line when run in the console updates the field "FirstName" If I look at the property of the field the default value has been updated but when previewing the form it does not show. 在控制台中运行时,以下行将更新“ FirstName”字段。如果我查看该字段的属性,则默认值已更新,但是在预览表单时不会显示。

this.getField("FirstName").defaultValue = "John"; 

Why is this ? 为什么是这样 ?

The defaultName is a property of the field which is not really visible; defaultName是该字段的属性,它实际上并不可见。 you'd have to refresh the field values to display the new defaultValue. 您必须刷新字段值才能显示新的defaultValue。

To do that, you have various possibilities: 为此,您有多种可能:

a) set the field value as well: a)还要设置字段值:

this.getField("FirstName").defaultValue = "John" ;
this.getField("FirstName").value = "John" ;

b) resetting the field b)重置字段

this.getField("FirstName").defaultValue = "John" ;
this.resetForm(["FirstName"]) ;

c) force a recalculation (not quite sure if it actually works) c)强制重新计算(不确定它是否确实有效)

this.getField("FirstName").defaultValue = "John" ;
this.calculateNow() ;

And that should do it. 那应该做到的。

Note that resetting the field means set the field's value to its defaultValue. 请注意,重置字段意味着将字段的值设置为其defaultValue。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM