Add timer on ui page

Rj27
Mega Guru

Hi All,
I have created a custom ui page that gets opened on click of a ui action on ritm. I am passing few values from ritm to this ui page. Ui Page as below:

find_real_file.png 

For each checkbox on the page, i need to set some timer ,say 5sec each. So in this case total timer should be set for 15secs. Timer will start once ui page loads.
If i click on Approve and Send button before 15secs, i should get an alert stating "I have not taken the standard time of 15secs to review this page. I I want to continue?." 
If i click on YES for this first alert, I should be able to proceed ahead. If NO is clicked on alert, i should be routed back to validation ui page.


How Can I add timer on ui page?

1 ACCEPTED SOLUTION

@Rj27 

Another way if you don't want to use GlideAjax to get the time when user clicks the button use this

function validate(){

var d = new Date();

var nowTime = (d.getTime())/1000; // get value in seconds

var initialTime = gel('hiddenValue').value;

var initialTimeSeconds = initialTime/1000; // get value in seconds

var diff = nowTime - initialTimeSeconds;

if(diff > 15){

alert('');

return false;

}

}

Regards
Ankur

View solution in original post

6 REPLIES 6

@Rj27 

you must be knowing when the UI page loads how many values so accordingly you can multiple with 5seconds

Regards
Ankur

Ankur Bawiskar
Tera Patron

@Rj27 

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

If not, please let us know if you need some more assistance.

Regards
Ankur