Skip to main content
Participant
April 21, 2024
Answered

Spawned pages and form fields

  • April 21, 2024
  • 1 reply
  • 1381 views

Hello,

 

I'm fairly new to javascripting and using teh spawn templae feature.  I'm having some trouble with fields on teh spawned pages and could use some advice/help.

My proplem is that I have a form I created (page 1 and 2 are identical for two-sided printing).  My desire is to have a button to spawn page 2 into page 3, 4, etc. as many times as needed.  Each page has fields at the very top (FROM, TO, MDS, Serial number) that need to repeat on each added page from page 1.  the button with script I created does that just fine.  The problem I run into is that all other feilds (JCN, Date DISC, Discrepancy, Discovered by (print) and Employee No. (3 copies on each page)) on the form need to be independent and not repeat the same data in same position on subsequent added pages.  What is happening is that my added pages are duplicating the data in those fields from page 2, which is not what I want.

I've searched the forums for help and have gotten some clues to fix some issues I have had, but I have not been able to get the results I need concerning the form fields.  Can anyone provide some assisance?  It will be greatly appreciated.

 

Thanks

Hawg1

This topic has been closed for replies.
Correct answer Nesa Nurani

The first 'false' is for renaming:

this.getTemplate("AFTO781A").spawn(this.numPages, true, false);

 

Nothing went wrong, bRename rename all fields, so if you need some values to remain same, you will have to use script in the template, let's say you want to copy value of 'field1" go to template page and in that field as custom calculation script use this: event.value = this.getField("field1").value;

now it will have the same value when spawned.

1 reply

Nesa Nurani
Community Expert
Community Expert
April 22, 2024

To rename all fields when spawned, set bRename to 'true'.

hawg1Author
Participant
April 24, 2024

This is what I currently have in my button.  I'm not sure what teh proper syntax is for the bRename function.  Can you tell me what that is?

 

thanks

hawg1Author
Participant
April 24, 2024

sorry, forgot the button script:

 

this.getTemplate("AFTO781A").spawn(this.numPages, false, false);