Skip to main content
pilotmitch
Participant
August 3, 2020
Answered

Set default value of PDF form field as the value of another field in the same PDF form

  • August 3, 2020
  • 1 reply
  • 10681 views

Does anyone know how to make the default value in a field be equal to another field.

For example if I had a field called "Name" and I wanted that field contents to be the Default value in a field called "Name2".  The idea is not having to input the value twice but leaving the possibility to change the value in field "Name2" "the default value" to another value if desired.

This topic has been closed for replies.
Correct answer ls_rbls

Custom calculation script.

 

Right-click on that field and select Properties from the context menu. Then go to the calculate tab.

 

See slide:

 

1 reply

ls_rbls
Community Expert
Community Expert
August 3, 2020

There's always many ways to achieve this with javascripting.

 

In  my case, this simple line of code worked for me:

 

 

event.target.value = this.getField("Name").value;

 

 

Use the script as custom calculation script in field "Name".

try67
Community Expert
Community Expert
August 3, 2020

You should use event.value here, not event.target.value .

ls_rbls
Community Expert
Community Expert
August 3, 2020

If I use event.value instead of event.target.value the Name2 field is not editable.

 

Using event.value =  this.getField("Name").value;  just grabs the value from the other field and doesn't allow the user to type in something different in Name2 field.