We currently have the following code - how do we adjust it to add multiple conditions so that the following statement reads “if aaa and bbb, then ccc”?
if (feathery.fields[‘aaa’].equals(‘Apple’))
feathery.fields[‘ccc’].options = [‘Cherry’];
We currently have the following code - how do we adjust it to add multiple conditions so that the following statement reads “if aaa and bbb, then ccc”?
if (feathery.fields[‘aaa’].equals(‘Apple’))
feathery.fields[‘ccc’].options = [‘Cherry’];
Moving the answer to this post:
You can use Javascript’s includes method (documentation).
if (a.value.includes('Apple') && a.value.includes('Apricot')) {
c.options = ['Carrot', 'Cashew', 'Cherry', 'Cantaloupe']
}
Just to confirm, would this be entered as the below?
if (feathery.fields[‘a’].value.includes(‘Apple’) && feathery.fields[‘a’].value.includes(‘Apricot’)) {
feathery.fields[‘c’].options = [‘Carrot’,‘Cashew’,‘Cherry’,‘Cantaloupe’]
}
You can directly use the field’s name as well.