how to close automaticaly a form after 30 seconds?

how to close automaticaly a form after 30 seconds?

  

I need to set a function / action, which close automatically my form after x seconds, without any actions by the users.

how is possible to do?


thanks

Hi Emanuela,

What do you mean by "closing"? 

It's in a popup and you want to close the popup? It's not a popup and you want to be redirected to another screen? Or you want to make it disabled? Or you just don't want to be possible to save the record in the entity after x seconds?

Cheers,

José

Hi Jose, 

I mean a web screen, I want it's closed automatically after 30 seconds. this form is used to show information.

thanks




José Costa wrote:

Hi Emanuela,

What do you mean by "closing"? 

It's in a popup and you want to close the popup? It's not a popup and you want to be redirected to another screen? Or you want to make it disabled? Or you just don't want to be possible to save the record in the entity after x seconds?

Cheers,

José




Hi Emanuela,

A easy way to do that is to use the window setTimeout() method, simply add the runJavaScript action to your screen preparation with this method.

The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds. So all you need to do is define a function to redirect the user to a new screen and the milliseconds.

For more information see here.

Best Regards,




Ruben Meireles wrote:

Hi Emanuela,

A easy way to do that is to use the window setTimeout() method, simply add the runJavaScript action to your screen preparation with this method.

The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds. So all you need to do is define a function to redirect the user to a new screen and the milliseconds.

For more information see here.

Best Regards,





Josè thanks.

 Ruben I try but it doesn't run. attached you can file what I do. For sure, not experience in JS ... where is the error?


Hi Emanuela

You can run the script below and it should work:

"setTimeout(function(){ window.close(); }, 5000);"

In your Script you are missing the quotation marks and I think your function is also incorrect.

Edit -  did not noticed that you where adding the JS to the screen, I thought you where doing as I suggested... please do as below its more simple:

 

If you want to add the JS to the screen you need to wrap it on a function, to call later on. 

Best Regards,

I follow your suggestion:


but in my wescreen detailfeedback where shall I put this one?


thanks

Emanuela,

The RunJavaScript should be put in the Preparation.

Cheers.

P.S:

The user can inspect the page and disable the timer...

Eduardo Jauch wrote:

P.S:

The user can inspect the page and disable the timer...

Exactly.

the result is:

 


no. I need redirect after xx seconds to another page "Homepage.aspx" for example, without any message.

Is it possible?


Hello Emanuela.

You can make the function called by the timer to click in a hidden link that navigates to the other screen, for example.

But as this is being done client side, the user will always be able to change it.

Solution

Hi Emanuela,

You can also do this in javascript:

"setTimeout(function(){ location='<url of the homepage>'; }, 5000);"

Replace the <url of the homepage> with the url that you want.

And as Eduardo has said, anybody can tamper with the javascript, so also check in the Screen Action of the submit button if 30 seconds (since the preparation was executed) have already passed or not.

Cheers,

José

Solution

José Costa wrote:

Hi Emanuela,

You can also do this in javascript:

"setTimeout(function(){ location='<url of the homepage>'; }, 5000);"

Replace the <url of the homepage> with the url that you want.

And as Eduardo has said, anybody can tamper with the javascript, so also check in the Screen Action of the submit button if 30 seconds (since the preparation was executed) have already passed or not.

Cheers,

José

Thank you !!! it works as I need.


José Costa wrote:

Hi Emanuela,

You can also do this in javascript:

"setTimeout(function(){ location='<url of the homepage>'; }, 5000);"

Replace the <url of the homepage> with the url that you want.

And as Eduardo has said, anybody can tamper with the javascript, so also check in the Screen Action of the submit button if 30 seconds (since the preparation was executed) have already passed or not.

Cheers,

José

Nice Solution, José :)

But still, everything done in client side can be messed by the user... lol