g_form.clearValue() is not working in catalog client script

Mohammed Masi U
Tera Contributor

Hi All, 

I am using onChange catalog client script on Var1. However, clearValue for Var2 is not working onChange.

Below is the Script. Kindly help.

 

g_form.clearValue('Var2');
g_form.clearOptions('Var2');


if (newValue == '1' || newValue == '2') {

g_form.addOption('Var2', '2', 'XYZ', 1);
} else if (newValue == '3') {

g_form.addOption('Var2', '1', 'XYZ', 1);
} else if (newValue == '6') {

g_form.addOption('Var2', '0', 'XYZ', 1);
} else {

 

g_form.addOption('Var2', '0', 'XYZ', 1);
g_form.addOption('Var2', '1', 'XYZ', 2);
g_form.addOption('Var2', '2', 'XYZ', 3);
g_form.addOption('Var2', '3', 'XYZ', 4);
g_form.addOption('Var2', '', '-- None --', 0);
}

1 ACCEPTED SOLUTION

Hi @Mohammed Masi U ,

 

No i meant instead of clearValue or clearOptions can u try remove option for Var2

 

Please mark my answer helpful if it satisfies your requirement

 

Thanks,

Danish

View solution in original post

4 REPLIES 4

Danish Bhairag2
Tera Sage
Tera Sage

Hi @Mohammed Masi U ,

 

Can u try g_for.removeOption for ur requirement

 

Thanks,

Danish

Hi @Danish Bhairag2 ,

Do you mean to use removeOption instead of addOption? If yes, how do I write an else statement?

 

Thanks!

Hi @Mohammed Masi U ,

 

No i meant instead of clearValue or clearOptions can u try remove option for Var2

 

Please mark my answer helpful if it satisfies your requirement

 

Thanks,

Danish

It worked! Thanks.