617
Views
13
Comments
Solved
how to close automaticaly a form after 30 seconds?
Discussion

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

2020-03-05 14-29-02
José Costa
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é

UserImage.jpg
Emanuela Avanzi

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.


2020-02-28 09-46-54
Eduardo Jauch

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


2020-03-05 14-29-02
José Costa

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é

UserImage.jpg
Emanuela Avanzi

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é




2021-03-08 09-24-09
Rúben Meireles

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,




UserImage.jpg
Emanuela Avanzi

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?


JS_Closewindow.PNG
2021-03-08 09-24-09
Rúben Meireles

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,

UserImage.jpg
Emanuela Avanzi

I follow your suggestion:


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


thanks

2020-02-28 09-46-54
Eduardo Jauch

Emanuela,

The RunJavaScript should be put in the Preparation.

Cheers.

2020-02-28 09-46-54
Eduardo Jauch

P.S:

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

UserImage.jpg
Emanuela Avanzi

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?


2020-02-28 09-46-54
Eduardo Jauch

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.

2020-03-05 14-29-02
José Costa
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é

UserImage.jpg
Emanuela Avanzi

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.


2020-02-28 09-46-54
Eduardo Jauch

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


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.