- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:11 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:37 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:28 AM
You need to do this changes only
Default:
if (isLoading || newValue == '')
Change it to
if (newValue == '')
It will run when the form is loading.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:30 AM
This is the actual need to do it.
An onLoad script will work when a form loads, it might be dependent on value of a field or some other condition.
For instance, If I hide Close Notes section for states other than Resolved & Closed, I will use an onLoad Script.
OnChange is always used when I want to change value of a field based on value of other field on the go.. So, If I want to give an alert box to user when he changes priority to 1, I would use onCHange
Mark it correct or helpful, If it helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2023 04:02 AM
Hey Ashwini, at times some functionalities or validations require to run ON LOAD and ON CHANGE at the same time, so instead of creating separate client scripts for ON CHANGE and ON LOAD we can create it in one ON CHANGE script by using this method
function onChange(control, oldValue, newValue, isLoading) {
if ( newValue == '') {
//your_code
return;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2019 12:37 AM
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