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

Populate text field spawned from a template based on a separate text field from a different spawned template.

New Here ,
Sep 14, 2017 Sep 14, 2017

I have a .pdf with a 'cover page' followed by six hidden templates.

Template 1 is called 'PreSurvey1' and template 4 is called 'PostSurvey1' (the others are not required in relation to this question).

When clicked, a button on the cover page automatically spawns a copy of each of these templates which appear in sequential order below. This can be done multiple times but the order in which the templates are spawned never changes.

I have a text field called TripDates_TB which appears on both Template 1 and 4. However, when the pages are spawned from the templates they assume the prefix P1.PreSurvey1.TripDates_TB and P4.PreSurvey1.TripDates_TB.  This means that the two fields are no longer linked (i.e. you have to enter data into each individually rather than it automatically populating the second instance).

So my question is, how would I go about linking them? I have been through the forum and my current thinking is that I would need to use javascript to split the instance of TripDates_TB on Template 4 and then update the prefix along the lines of P4-3 (i.e. giving a value of P1).

This should then hold true for additional spawns? (i.e. a second round of templates spawns would produce  P7 and P10 so P10-3 would equal P7).

I have tried with my limited understanding of javascript to come up with something like this but am having no success.

Any help would be much appreciated!

TOPICS
Acrobat SDK and JavaScript , Windows
251
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 ,
Sep 15, 2017 Sep 15, 2017
LATEST

An option is to add an additional template that is a blank page that also has the date field. Remove the date field from the other template pages. After you spawn either the Pre or Post templates, also spawn the template with the date field on the newly created page, but don't rename the fields (bRename = false). So the name of the date field on the newly created pages will be named the same as the original (TripDates_TB).

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