onChange script error: RangeError: Maximum call stack size exceeded function () { [native code] }

pramodkumar
Tera Expert

Hi All,

I have 2 checkboxes on a form and there are 2 onchange client scripts on each of them. Whenever I tried to make update it, I am getting below error

onChange script error: RangeError: Maximum call stack size exceeded function () { [native code] }

 

below is the script on checkbox1:

 if (isLoading || newValue == '') {
      return;
   }
var ch = g_form.getValue('checkbox2');
    if(ch == 'true'){
        g_form.clearValue('checkbox1');
        alert("Select only one");
 

below is the script on checkbox2

 if (isLoading || newValue == '') {
      return;
   }
var ch = g_form.getValue('checkbox1');
    if(ch == 'true'){
        g_form.clearValue('checkbox2');
        alert("Select only one");
7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@pramodkumar 

I think your script is going in loop

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

thanks @Ankur Bawiskar  for looking into this

below is our requirement

we have four checkboxes on a catalog form checkbox1, checkbox2, checkbox3, checkbox4 . out of checkbox1 and checkbox2 only one of them is required for submission(either checkbox1 or checkbox2 not both) and from checkbox3 and checkbox4 only one of them is required for submission ((either checkbox3 or checkbox4 not both) . How can achieve this?

@pramodkumar 

handle this using onSubmit client script

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar thank you. If possible can you please provide the sample script?