Skip to main content
December 15, 2017
Question

Spawn template page clears check box values

  • December 15, 2017
  • 1 reply
  • 1213 views

Hi,

I have a fillable form PDF with buttons at the bottom of certain page that add a duplicate blank form page (giving the user more room to add information). The template page has both text fields and check boxes.

When using the button, the additional page is added fine, but the check boxes on the first page are all cleared when they shouldn't be.

Any thoughts as to why this might be happening? This is the Javascript code I am using.

var expTplt = getTemplate("TemplatePage");

expTplt.spawn({nPage: pageNum + 1, bRename: true, bOverlay: false});

Thanks!

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
December 15, 2017

That's indeed strange. The problem is usually the other way around, ie the fields in the spawned page retain the values from the template page and need to be reset.

Do you have some kind of script that checks (or unchecks) these check-boxes anywhere in your file? Maybe it gets triggered when the page is spawned...

December 15, 2017

There's a button to "Clear Form". It's not using Javascript, it's just set to Reset a Form.

The problem you mentioned, that the page usually retains the fields in the template....I avoided that by doing the following:

1) I added the page as a template

2) spawned a page

3) hid the template page

So the button is actually on both the template and spawned pages. That way you can add as many pages as you need. Is there something there that could be the source of the issue?

What I am finding as I'm playing with it more:

1) the first spawned page is on page 4, and has the button at the bottom to add another page. Because this page is a spawned page rather than the template itself, all of the checkbox fields are in the format P4.fieldname.checkbox#0, or something similar.

2) when you click the button to add a page, it adds a page directly afterwards (so page 5), but the fields are formatted like P4.fieldname.checkbox#1. Why would it use P4 if it's page 5?

3) spawning an additional page (page 6) gives field names like P5.fieldname.checkbox#0.

Could this be part of the problem?

try67
Community Expert
Community Expert
December 15, 2017

Could be. If you're spawning to the same page number they you will get duplicate field names, which might cause a reset.