Splash Screen using setTimeout

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
RichDotsonMTD
Profound User
Posts: 30
Joined: Mon Jun 22, 2020 1:48 pm
First Name: Rich
Last Name: Dotson
Company Name: MTD Products
State / Province: Ohio
Country: United States
Contact:

Splash Screen using setTimeout

Post by RichDotsonMTD »

I created a record format in my UI to display a splash screen prior to running a long process that pulls data from our Salesforce org. I use the javascript example that is on the ProfoundUI doc website and other forum posts to set a timer in the onLoad event and clear it in the onSubmit event. The auto-submit process does not work the first time I click on the button that initiates the data pull but it does auto-submit every time after that first time.

I've included screen captures and the UI JSON as an attachment.

How can I get it to work the first time the process is initiated?

onLoad Event Javascript

Code: Select all

window.savedTimer = setTimeout(function() {
  setTimeout( function() { pressKey("ENTER"); }, 500);
}); 
onSubmit Event Javascript

Code: Select all

window.savedTimer = null;
if (window.savedTimer) {
  window.cancelTimeout(savedTimer);
  window.savedTimer = null;
}
splash.PNG
splash.PNG (248.32 KiB) Viewed 5853 times
Attachments
splash2.PNG
splash2.PNG (110.26 KiB) Viewed 5853 times
splash.json
(76.55 KiB) Downloaded 597 times
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Splash Screen using setTimeout

Post by Scott Klement »

Is it possible that part of the Profound UI application is still communicating with the server in the background?

If you try to submit the screen when it hasn't finished loading, or is still finishing up its communication with the IBM i to draw the screen, then it will ignore the screen submission... expecting that you'll try again later. That's what comes to mind when reading about your dilemna.

Have you tried increasing the time on the timeout? Or, making a simpler screen?
RichDotsonMTD
Profound User
Posts: 30
Joined: Mon Jun 22, 2020 1:48 pm
First Name: Rich
Last Name: Dotson
Company Name: MTD Products
State / Province: Ohio
Country: United States
Contact:

Re: Splash Screen using setTimeout

Post by RichDotsonMTD »

I removed the image and increased the time on the timeout to 10000 but that did not change anything.

Code: Select all

window.savedTimer = setTimeout(function() {
  setTimeout( function() { pressKey("ENTER"); }, 10000);
});
lyarbrough
New User
Posts: 16
Joined: Mon May 08, 2017 11:51 am
First Name: Lillie
Last Name: Yarbrough
Company Name: Profound Logic
Contact:

Re: Splash Screen using setTimeout

Post by lyarbrough »

Hi Rich,

It looks like there are some mistakes in your JavaScript code that could be causing the problem you're experiencing. Please edit your onload event to use the following:

Code: Select all

window.savedTimer = setTimeout(function() {
	window.savedTimer = null;
	pressKey("ENTER");
}, 500);
and your onsubmit event to use this:

Code: Select all

if (window.savedTimer) {
	clearTimeout(window.savedTimer);
	window.savedTimer = null;
}
There's more information about this here: https://docs.profoundlogic.com/x/qgCzAQ.

Could you give this a try?
Lillie Yarbrough
Technical Support Specialist
RichDotsonMTD
Profound User
Posts: 30
Joined: Mon Jun 22, 2020 1:48 pm
First Name: Rich
Last Name: Dotson
Company Name: MTD Products
State / Province: Ohio
Country: United States
Contact:

Re: Splash Screen using setTimeout

Post by RichDotsonMTD »

Hi Lillie,

I Copied/Pasted the Javascript from your post and placed it in my UI but that didn't fix it.
Attachments
splash3.png
splash3.png (36.25 KiB) Viewed 5805 times
User avatar
jaliling
Profound Logic Staff Member
Posts: 3
Joined: Fri May 28, 2021 10:13 am
First Name: Joe
Last Name: Aliling
Company Name: Profound Logic Software, Inc.
Contact:

Re: Splash Screen using setTimeout

Post by jaliling »

Hi, I have checked your display file and it looks like you have set the "external javascript" property of your Splash screen to a CSS URL which supposedly should be a Javascript file.
splash.PNG
splash.PNG (11.34 KiB) Viewed 5784 times
Could you remove that and try running the program again? I was able to make it work in my test environment with your Splash screen by simply removing that.

If you need to add more than one external CSS files, you could do a right-click on the "external css" property and the "Add Another External CSS" option will allow you to include additional external CSS files.
add external css.PNG
add external css.PNG (14.65 KiB) Viewed 5784 times

Best regards,
Joe
RichDotsonMTD
Profound User
Posts: 30
Joined: Mon Jun 22, 2020 1:48 pm
First Name: Rich
Last Name: Dotson
Company Name: MTD Products
State / Province: Ohio
Country: United States
Contact:

Re: Splash Screen using setTimeout

Post by RichDotsonMTD »

Joe,

That sort of fixed it. It works great if I display the splash screen from the "main" page and return to the main page.

It does not work correctly when:

1. I display the splash screen and then display a secondary popup window. It doesn't seem to be turning the timer off because the second popup window is repeatedly submitted back to the server.

2. The splash screen does not appear at all if I try to display the if from a secondary popup window.

Thanks for all the help.

-Rich
RichDotsonMTD
Profound User
Posts: 30
Joined: Mon Jun 22, 2020 1:48 pm
First Name: Rich
Last Name: Dotson
Company Name: MTD Products
State / Province: Ohio
Country: United States
Contact:

Re: Splash Screen using setTimeout

Post by RichDotsonMTD »

Joe,

I played around with some of the property values on all my record formats and I was able to get this to work on all screens.

Thanks for your help on this. The ProfoundUI support was superb as always.

-Rich
User avatar
jaliling
Profound Logic Staff Member
Posts: 3
Joined: Fri May 28, 2021 10:13 am
First Name: Joe
Last Name: Aliling
Company Name: Profound Logic Software, Inc.
Contact:

Re: Splash Screen using setTimeout

Post by jaliling »

Hi Rich,

We're so happy to hear that you got it sorted it out!

Best regards,
Joe
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest