need to hold screen for 3 secs when any option is getting changed on form

anshul_jain25
Kilo Guru

I want to hold screen for around 3 secs when i am changing a value of a variable on my form,

what will be the function that i can use in my on change client script.

1 ACCEPTED SOLUTION

Aakash Shah4
Tera Guru

For client side you can use setTimeOut()


Window setTimeout() Method


View solution in original post

9 REPLIES 9

Aakash Shah4
Tera Guru

Hi Anshul,



if you are using a server side script use gs.sleep()



Check this


how to keep waiting the business rule for some time.  


Aakash Shah4
Tera Guru

For client side you can use setTimeOut()


Window setTimeout() Method


amis
Kilo Expert

Hi Anshul,



You can introduce delays or wait in Client Scripts using following


Name: Sleeps, Delays, or Waits in Client Scripts


Type: Client Script


Table:


Description: This script allows for a delay in a client script.


Parameters:


Script:


function onChange(control, oldValue, newValue, isLoading) { 
if (newValue == oldValue){
return;
}  
window.setTimeout(fun2,5000);
}  
function fun2(){
// do your stuff here
alert('I waited 5 seconds.');
var caller = g_form.getReference('caller_id');
g_form.setValue('location', caller.location);
}
Refer to link http://wiki.servicenow.com/index.php?title=Sleeps,_Delays,_or_Waits_in_Client_Scripts#gsc.tab=0

R's


Abhi



PS: Mark helpful or hit like as appropriate based on my response


set timeout is not holding screen, its running that particular function after 3 secs, what i want it to hold screen, is there something like wait, or pause screen.