Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

script called as many times as masterpage is used

Avatar

Not applicable
Hello,



When people build a form with n pages, and a global script within, there's a strange behaviour with the script.



When this form loads, this global script is called as many times as the total number of pages in my form, like if it was instanciating it again and again



How avoid it ?



Thanks for your help !
1 Reply

Avatar

Level 5
Here some sample JavaScript code that might help you resolve the issue.



var curPageNum = xfa.host.currentPage + 1; // this is index

// based starts with 0



if (curPageNum == 1) {

// run your current script here then it will run only one

//time on page 1

}