LFForm.disableFields({ fieldId: 54, index: 0 });
This is a good format. My initial thought may be there are asynchronous functions like adding / deleting rows (ex: LFForm.addrow()) that may be interfering with this. If it is an order of operations issue like this, it can be solved using the "await" and "async" keywords.
However, I've also had difficulty using certain methods that seem finnicky.
Example: I had two collections:
- Collection1: A fixed Length of 1
- Collection2: Can append to include however many rows.
This code worked great on collection 1:
const _Collection1 = { fieldId: 20 }
LFForm.changeFieldSettings(_Collection1, {CSSClasses : "denied"})
However, with Collection 2 I had to get more creative and relay each field in each row, rather than apply CSS to the row:
const _Collection2Row1 = {fieldId: 10}... // same for Rows 1 through 10
const _Collection2Rows = [_Collection2Row1, Collection2Row2..., Collection2Row10]
_Collection2Rows.forEach(f => LFForm.changeFieldSettings({fieldId: f['fieldId'], index: i}, {CSSClasses : "denied"}))
I really prefer using Code over Field Rules whenever possible (but there are some cases, like NOT saving data on hidden fields or LookupRules when I have to compromise). Hopefully this puts you on the right track, but when I get a second to play around I'll see what I can find. You could even try LFForm.hideFields() + clearing with LFForm.setFieldValues() potentially.