Page 1 of 1
nuOnLoad keeps triggering
Posted: Wed Jan 10, 2018 5:00 pm
by toms
Hi,
I added nuOnLoad() in a form's javascript. When the form is opened, the function gets triggered for the first time. (ok so far)
Now the function keeps getting triggered even when I open other forms.
Code: Select all
function nuOnLoad()
{
console.log("nuOnLoad");
}
Adding a if (window.top === window.self) didn't help either.
Check out my recording that illustrates the issue:
https://vimeo.com/250463563
Re: nuOnLoad keeps triggering
Posted: Wed Jan 10, 2018 11:26 pm
by admin
toms,
That is what it is supposed to do.
http://wiki.nubuilder.net/nubuilderfort ... t#nuOnLoad
If you want something to run on just 1 Form then just place that code in the Javascript section of the Form...
http://wiki.nubuilder.net/nubuilderfort ... Javascript
Steven
Re: nuOnLoad keeps triggering
Posted: Wed Jan 10, 2018 11:35 pm
by toms
Steven, the code is in the Javascript section of the Form. You can see it in my recording.
Re: nuOnLoad keeps triggering
Posted: Wed Jan 10, 2018 11:56 pm
by admin
toms,
nuOnLoad will stay in memory (as with any Javascript function in Forte) unless you overwrite the nuOnLoad function or do this or set it to null eg.
Steven
Re: nuOnLoad keeps triggering
Posted: Thu Jan 11, 2018 6:31 am
by toms
Setting nuOnLoad = null should do the job.
I also noticed that adding nuOnLoad() in a form's JavaScript will override the nuOnLoad() that is declared in the Header of Setup.
In other words, as soon as the form's nuOnLoad() is initialized, the header's nuOnLoad() does not fire anymore.
To come around this issue, a new event nuLoadGlobal() could be introduced that can be used in the Header of Setup.
Re: nuOnLoad keeps triggering
Posted: Thu Jan 11, 2018 6:46 pm
by admin
toms,
nuOnload() is what you should use to run things globally.
If you want to run something on just one Form, then just put it in the Javascript section of that Form (but not inside a function called nuOnload().)
eg.
Not...
Code: Select all
function nuOnLoad()
{
console.log("nuOnLoad");
}
Steven
Re: nuOnLoad keeps triggering
Posted: Fri Jan 12, 2018 4:55 am
by toms
Thank you for your clarification!
Re: nuOnLoad keeps triggering
Posted: Fri Jan 12, 2018 6:53 pm
by admin
.