You need to sign in to do that
Don't have an account?

Applying value to a particular record in for each loop - JS
let recordEditForm = this.template.querySelector('lightning-record-edit-form');
let fields = {};
this.fieldSetFields.forEach(field=> {
console.log('##### I am on line1254##### field value is ## '+ JSON.stringify(field.css));
let keyVal = field.key;
let fieldVal = this.template.querySelector('.' + keyVal).value;
fields[field.fieldName] = fieldVal;
//console.log('## I am on line 1187@@@@@@ ' + field + ' - '+ i);
if(this[i].keyVal=='Sales_Authorization_Type__c-1'){
console.log('##### i am on line 1186');
field[i].css = this.keyVal + 'slds-show';
console.log('@@@@ I am on line 1191@');
}
});
While iterting through JS for loop, the shown above, the css property 'slds-show' should apply to only the record that matches the if criteria, but sls-show property is being applied to all the elements which the loop is iterating over it.
Let me know what the issue could be.
let fields = {};
this.fieldSetFields.forEach(field=> {
console.log('##### I am on line1254##### field value is ## '+ JSON.stringify(field.css));
let keyVal = field.key;
let fieldVal = this.template.querySelector('.' + keyVal).value;
fields[field.fieldName] = fieldVal;
//console.log('## I am on line 1187@@@@@@ ' + field + ' - '+ i);
if(this[i].keyVal=='Sales_Authorization_Type__c-1'){
console.log('##### i am on line 1186');
field[i].css = this.keyVal + 'slds-show';
console.log('@@@@ I am on line 1191@');
}
});
While iterting through JS for loop, the shown above, the css property 'slds-show' should apply to only the record that matches the if criteria, but sls-show property is being applied to all the elements which the loop is iterating over it.
Let me know what the issue could be.