Need to remove choice from the field when selecting another choice from another field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2022 06:31 AM - edited 12-30-2022 06:33 AM
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');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2022 06:45 AM - edited 12-30-2022 06:49 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2022 06:49 AM
No, it's not working. It's adding another choice.