I assume you are renaming the fields on the spawned pages.
You will notice that the form fields are prefixed with the the page number and the template that the new page was crated from. So you need to adjust your scripts to extract these prefix values and use then to adjust you scripts.
I find that renaming your page 1 field to include the "P0.[templateName]." prefix makes all of the coding on each page consistent.
Thanks for the reply. The fields are renamed when the pages are spawned (rename parameter is true), but the calculated value on the spawned page does not reflect the renamed fields on the spawned page. I'll try your tip on renaming the fields on the template to match the spawned pages to see if that helps.
Do not change the names for the fields on the template.
I create the template, then spawn the first page. Now I create the scripts for the first page and create variables for the "P#" and "template" name prefixes. After I get them debugged on page 1, I add the scripts to the template and spawn a second page and test the scripts.
Ok, I think I get what you are saying.
If I understand you, I need to create a custom calculation (instead of using the simple 'sum' of the desired field) which parses the page# and template name from the calculated field name (event.target.name) and use that to determine the fields to use for the calculation on that page.
Another question, I noticed that if the user deletes a spawned page, then a new page could be generated which uses the same name as an existing page (e.g. if page 3 of 4 is deleted, then the next page spawned will also use #4 and duplicate the values on both pages). Is there any way to avoid/correct this?