Need to remove choice from the field when selecting another choice from another field

Ashoka Panchal
Tera Contributor

I wrote a script to remove the option from the field, and it works when I change the field values. However, if I switch to the same field, the field the choice does not appear on the choice list. 

If I swatch from renewal to other values, it's working(the options removing). If I change from another field to renewal, the option is not showing. 

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

//Type appropriate comment here, and begin script below
var transactionType = g_form.getValue('transaction_type');
if (transactionType == 'renewal') {
//alert('test1');
// do nothing
} else {
alert('test2');
g_form.removeOption('bound_declined', 'not renewed');
}

}

2 REPLIES 2

Matthew Smith
Kilo Sage

If you have previously removed the option then I believe you will need to re-add it via the script. Add the following above //alert('test1')

 

g_form.addOption('bound_declined', 'not renewed', 'Display value of not renewed choice');

 

Hope it helps.

 

- Matt

No, it's not working. It's adding another choice.