I have a radio button with Yes and No. And a dropdown field. I have this javascript when Yes is selected then the dropdown should be filled with TMHP and nothing should happen when No is selected. I tried this LFForm.setFieldValues({fieldId: 77},'TMHP'); on the outside of the If statement and the field does get populated with TMHP. However, when it is inside the If statement it will not work. Below is my code.
LFForm.onFieldChange(function() {
if (LFForm.getFieldValues({ fieldId: 146}) === 'Yes') {
LFForm.setFieldValues({fieldId: 77},'TMHP');
} else {
}
}, { fieldId: 146 });