JamesT
JamesT

Reputation: 3

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. 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.

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

Why is this ?

Upvotes: 0

Views: 656

Answers (1)

Max Wyss
Max Wyss

Reputation: 3605

The defaultName is a property of the field which is not really visible; you'd have to refresh the field values to display the new defaultValue.

To do that, you have various possibilities:

a) set the field value as well:

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

b) resetting the field

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

c) force a recalculation (not quite sure if it actually works)

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.

Upvotes: 1

Related Questions