3107
Views
10
Comments
Solved
How  to reload a ScreenAction every 30 seconds with JavaScript?
Question

Hi guys,

How  to reload a ScreenAction every 30 seconds with JavaScript?

2018-12-17 04-50-28
Manish Pandey
Solution

Hi Diego,

Create one button in screen with hide style (Create one destination action and refresh the div by ajax ).
And add java script in expression to refresh the particular screen on your specific interval.

"<script type=""text/javascript"">

function refeshPage(){
    $('#"+ btn_Refresh.Id +"').click();
}
var RefresthTimer = 10*60*1000;//minutes by seconds (add your time interval)

jQuery(document).ready(function() {
    // refreshing value
    setInterval(refeshPage, RefresthTimer);
});
</script>"


Thanks,

Manish Pandey

2018-10-01 10-21-00
Diego Souza

Manish Pandey wrote:

Hi Diego,

Create one button in screen with hide style (Create one destination action and refresh the div by ajax ).
And add java script in expression to refresh the particular screen on your specific interval.

"<script type=""text/javascript"">

function refeshPage(){
    $('#"+ btn_Refresh.Id +"').click();
}
var RefresthTimer = 10*60*1000;//minutes by seconds (add your time interval)

jQuery(document).ready(function() {
    // refreshing value
    setInterval(refeshPage, RefresthTimer);
});
</script>"


Thanks,

Manish Pandey

Thank you Manish Pandey


2017-12-13 08-27-28
Joey Moree

Hmm, I think the cleanest solution would be, to have a webblock, which notifies every 30 seconds, then on the notify you can trigger your server action.

You can also try using a timer which clicks a hidden button or changes some value in a hidden input and trigger your server action on the submit or on change.

2018-10-16 12-50-10
Cristiano Chamorra
Staff

Hello Diego,


You have this component on forge, called Auto Refresh Utils, https://www.outsystems.com/forge/2134/


Hope it helps,

Cristiano Chamorra

2021-10-17 12-36-16
Amreen Shaikh

Hi Diego,


https://www.outsystems.com/forge/component-overview/195/light-ajax-refresh i also available  on forge.


Regards,

Amreen

2018-09-06 22-01-31
Viraj Kataria

Hi Diego Souza,

The easiest solution to refreshing the page is to add this inside the head:

<meta http-equiv="refresh" content="30" />

to refresh it every 30 seconds.

You can do similar with Javascript by doing:

setTimeout('window.location.href=window.location.href;', 30000);
setTimeout('window.location.reload();', 30000);
setTimeout('history.go(0);', 30000);

Both of these will completely reload the page every 30 seconds.

Hope this helps!
Thanks

2018-09-07 10-04-42
Suhas Jamdade

Hello Diego Souza

Using JavaScript setInterval() function you can achieve your destination.

2016-04-15 10-32-21
marco groenenberg

For reactive:

Make a refresh button on your screen.

Add a javascript on render:

On Render

  setInterval(function(){ document.getElementById($parameters.InputId).click(); }, 2000);


2020-07-01 10-39-16
Hussein Elsayed

Make a refresh button on your screen.

Add a javascript on render:

On Render


var btn = document.querySelector($parameters.ButtonId);

setInterval(function(){

btn.click();

}, $parameters.Interval * 1000);


or You can use forge Component directly:


https://www.outsystems.com/forge/component-versions/10593/version/0/platform/11

2022-04-08 00-37-21
daichi ishikawa

1. Make a client action (screen action) on your screen. In the case here it is "SampleClientAction".

2. Add a OnReady event to the screen.

3. Add a javascript the OnReady event. All you have to do is write this one line.

   setInterval(function(){$actions.SampleClientAction()}, 30000);

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