Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

what is the difference between onload client script and onchange client script.

ImmadisettyP
Tera Contributor
 
5 REPLIES 5

Kieran Anson
Kilo Patron

If you're new to ServiceNow, I recommend reviewing the content on the developer website. 

 

https://developer.servicenow.com/dev.do#!/learn/learning-plans/xanadu/new_to_servicenow/app_store_le...

AshishKM
Kilo Patron

Hi @ImmadisettyP

Refer the belo , also check the developer portal link shared by @Kieran Anson .

 

In HTML, "onload" is an event that fires when an entire webpage has finished loading, including all its elements like images and scripts, while "onchange" is an event that occurs when the value of a specific HTML element (like a text input or dropdown menu) is changed by the user

 

onChange - Client Scripts execute script logic when a particular field's value changes

onLoad - Client Scripts execute script logic when forms are loaded.

 

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Debasis Pati
Kilo Sage

Hello @ImmadisettyP 


onLoad means the Client Script runs when the form or page is loaded
onChange means the Client Script runs when something specific gets changed AND also when the form or page loads
Additional parameter for onChange client script is : isLoading - identifies whether the form is loading and also indicates that no fields have changed value. This parameter can only be true when the form is loading and no values have changed.

To know more about client scripts please go through - https://www.servicenow.com/docs/bundle/yokohama-api-reference/page/script/client-scripts/concept/cli...

 

If my answer helps you please mark it as helpful/correct.

Regards,
Debasis

dgarad
Tera Sage

Hi @ImmadisettyP 

  • onLoad means the Client Script runs when the form or page is loaded
  • onChange means the Client Script runs when something specific gets changed AND also when the form or page loads

Additional parameter for onChange client script is : isLoading - identifies whether the form is loading and also indicates that no fields have changed value. This parameter can only be true when the form is loading and no values have changed.

If my answer finds you well, helpful, and related to the question asked. Please mark it as correct and helpful.

Thanks
dgarad