process.html - JavaScript - not executing on multi-page

1
0
-1

Hi there,

I have a problem with JavaScript **not executing **on my pages as follows: (needs knowledge of using browser console)

Process has a form ProcessF1

Four Human Tasks (separate tasks) have forms HumanF1, HumanF2, HumanF3, HumanF4

In my Process Application Resources/Look'n'Feel I have some JavaScript which I load in the page.html head (either by file or hard coded).

The JavaScript (as an example) is as follows:

alert("01");
var currentdate = new Date();
var datetime = "Last Sync: " + currentdate.getDate() + "/"
                + (currentdate.getMonth()+1)  + "/"
                + currentdate.getFullYear() + " @ "  
                + currentdate.getHours() + ":"  
                + currentdate.getMinutes() + ":"
                + currentdate.getSeconds() + ":"
                + currentdate.getTime();
console.log("datetime "+datetime);
alert("02");

$(document).ready(function(){
        // your code
        alert("03");
        console.log("page.html: $(document).ready(function(){");
        var currentdate = new Date();
        var datetime = "Last Sync: " + currentdate.getDate() + "/"
                        + (currentdate.getMonth()+1)  + "/"
                        + currentdate.getFullYear() + " @ "  
                        + currentdate.getHours() + ":"  
                        + currentdate.getMinutes() + ":"
                        + currentdate.getSeconds() + ":"
                        + currentdate.getTime();
        console.log("datetime "+datetime);
});
alert("04");

Simply put this code just writes out the date/time, my real code obviously does something very different.

What happens during execution is as follows:

Process Form loads - works as expected, click submit Human Form 1 loads - JavaScript works as expected with time being output to the browser console, click submit Human Form 2 loads - JavaScript DOES NOT WORK, click submit Human Form 3 loads - JavaScript DOES NOT WORK, click submit Human Form 4 loads - JavaScript DOES NOT WORK, click submit

Why would it not work? Well Human Form 2 does work - it displays correctly. But the JavaScript is not running for the new pages.

From my understanding a new page is a new page and must always reload and execute the JavaScript, what is happening here and how do I fix it?

Many thanks and best regards

No answers yet.
Notifications