Does onChange client script works on load of the form?

theBeastMaster
Mega Guru

Does onchange client script works on load of the form?

1 ACCEPTED SOLUTION

Shweta KHAJAPUR
Tera Guru

Hi,

Yes, it will work on Load of form also. There is parameter called 'isLoading' which should be set to true. write onChange() as below

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
return;
}

//Type appropriate comment here, and begin script below

}

Regards,

Shweta K

View solution in original post

3 REPLIES 3

Shweta KHAJAPUR
Tera Guru

Hi,

Yes, it will work on Load of form also. There is parameter called 'isLoading' which should be set to true. write onChange() as below

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
return;
}

//Type appropriate comment here, and begin script below

}

Regards,

Shweta K

Hi,

If you find the solution please mark it as Correct and Helpful. Also Close the thread.

 

Regards,

Shweta K

Mrigank Gupta
Giga Expert

Yes, onchange client script runs on form load also.

When we open the form, it first creates the whol structure and then fills the values in it, and here the onchange client script gets triggered.

We have a boolean flag already provided by the platform to handle this : isLoading

It is must to validate whether isLoading is true or false.

if(isLoading)

return;

 

Else the form will give unexpected results. Run this cleint script onload only when its really required.