Client Script: Reload page based on field conditions

Desmo
Mega Guru

Hello community,

 

I attempting to create a client script that reloads a form onChange. When the State field changes to a specific value (e.g. 7), reload the page. However, the script reloads for every state. Also, I attempted to add condition where Category is a specific value (e.g. Application)--it did not work.

 

Assistance is appreciated.

 

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

    if ((newValue == '7' ));
	
        location.reload();

}

 

Regards.

1 ACCEPTED SOLUTION

Samaksh Wani
Giga Sage
Giga Sage

Hello @Desmo 

 

Plz Correct your Script with mentioned below:-

 

 

 

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

if(newValue == '7'){
 location.reload();
}

}

 

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

 

View solution in original post

1 REPLY 1

Samaksh Wani
Giga Sage
Giga Sage

Hello @Desmo 

 

Plz Correct your Script with mentioned below:-

 

 

 

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

if(newValue == '7'){
 location.reload();
}

}

 

 

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh