Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

copy data from one form field to another

Community Beginner ,
May 06, 2016 May 06, 2016

Hi there

I want to make a form to print labels.

I want to print 6 labels on one page

Date on the first label is present date (I have used Date Printed).

Date on next label must be DatePrinted+1, the date on the 3rd label DatePrinted+2 etc etc

Also I have a text field on each and every label. I just want to enter text in the text field on label1 and have this text copied in the same text field on the other 5 labels.

How do I get this done?

TOPICS
Acrobat SDK and JavaScript , Windows
3.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 07, 2016 May 07, 2016

When you want the same text in fields assign the same name to the text fields.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 07, 2016 May 07, 2016

Not only is the value shared between the fields with the same name but some other properties like "required" and "read only" are also shared. So if one wants to have another field with the same value but "read only" one needs to create a second field with a different name. In this case, one will need to update the second field when the first field is updated. This could be done using the calculation action. Under this scenario the update will occur each time any calculated field needs to be updated. One can use the "on blur" action update the second field with a script. Since you have multiple fields with this scenario, I would develop a script that adjust the name for the second field base on the first field's name. So I could have field like "Name" and create a second field like "Name_Duplicate" that would take on the value of the field named "Name" but have some different propertites. One could use the following script in the "on blur" action to copy the value of the field to the second field "_Duplicate" and use in any group of fields.

this.getField(event.target.name + "_Duplicate").value = event.target.value;

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 02, 2017 Mar 02, 2017
LATEST

Can I use this script to copy the value but modify its format? For instance, I want the date in 2 different fields but in the first field it would have the date entered as m-d-yyyy and in the second it would autopopulate to be mmm-yy based on the first field.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines