onchange client script not working

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

   //Type appropriate comment here, and begin script below
   if (newValue == 6) {
        g_form.setMandatory('close_code', true);
        g_form.setMandatory('close_notes', true);
       // g_form.setDisplay('assignment_group', false);

    } else {
        g_form.setMandatory('close_code', false);
        g_form.setMandatory('close_notes', false);
       // g_form.setDisplay('assignment_group', true);
    }
}
2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@laxmilinux1 Could you please check the following and se if it works.

 

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

   //Type appropriate comment here, and begin script below
   if (newValue == '6') {
        g_form.setMandatory('close_code', true);
        g_form.setMandatory('close_notes', true);
       // g_form.setDisplay('assignment_group', false);

    } else {
        g_form.setMandatory('close_code', false);
        g_form.setMandatory('close_notes', false);
       // g_form.setDisplay('assignment_group', true);
    }
}

Rakesh_darshnal
Tera Contributor

Hi @laxmilinux1 
The script you have written is correct but please check the second line where you have missed a quote after new value.
change it from newValue===" to newValue === " ", this will wwork.
Regards,
Rakesh Darshnala