The CreatorCon Call for Content is officially open! Get started here.

Can we change onChange client script into onLoad?

Ashwini Jadhao
Giga Guru

hi,

How to change onChange client script into onLoad client script?

 

 

 

1 ACCEPTED SOLUTION

Service_RNow
Mega Sage

HI Ashwini,

if you need to Onchange client script is behavior like Onchange as well as onload -:

do the simple change in if condition remove the isLoading || 

eg.

function onChange(control, oldValue, newValue, isLoading) {
if ( newValue == '') {
//put your code here 
return;
}
}

Thanks

 

View solution in original post

8 REPLIES 8

Snehal Pawar
Tera Expert

Hi,

You can refer below url

https://community.servicenow.com/community?id=community_question&sys_id=6e501729dbdcdbc01dcaf3231f961936

 

Mark it correct or helpful , If it helps you.

 

Thanks,

Snehal.

Devyani_6
Mega Guru

Hi Ashwini,

Yes, we can do that.

Whatever you want to do on load, put that inside if statement.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') 
   {

     // Put your onload scripting here 


      return;
   }

   //Type appropriate comment here, and begin script below
   
}

Mark correct based on impact of response.

Regards,

Devyani

www.dxsherpa.com

 

Snehal Pawar
Tera Expert

Hi,

Else you can use below script.

Default:

if (isLoading || newValue == '')

Change it to

if (newValue == '')

It will run when the form is loading.

Ashwini Jadhao
Giga Guru

Thank you,

 

          I got it,but what is the need to change onChange client script into onLoad.