I have created 4 lighting-record-edit forms on a custom object. On the click of a button, I want to check each one of the fields. I need to check if field A is populated that either field B or C is populated. In addition, there is a percentage field on the lightning-record-edit form that I need to make sure the total of all 4 records is not more than 100%
Here is what one of the 4 lighting-record-edit-form's look like They all have the same exact info except I only have a onSubmit on the first one.
<!-- Incented Employee #1 Primary-->
<lightning-layout-item padding="around-small">
<lightning-record-edit-form object-api-name="Incented_Employees__c" data-id="IeForm" onsubmit={handleSubmit} onsuccess={handleIeSuccess}>
<div class="slds-grid slds-gutters">
<div class="slds-size_6-of-12">
<lightning-input-field lwc:ref="employee1" field-name="Employee__c" required={ie1IsAccountManager}></lightning-input-field>
</div>
<div class="slds-size_3-of-12">
<lightning-input-field lwc:ref="type1" field-name="Type__c"></lightning-input-field>
</div>
<div class="slds-size_3-of-12">
<lightning-input-field field-name="Member_Lock_In__c"></lightning-input-field>
</div>
<div class="slds-size_4-of-12">
<lightning-input-field lwc:ref="percentage1" field-name="Member_Credit_Percentage__c"></lightning-input-field>
</div>
</div>
</lightning-record-edit-form>
</lightning-layout-item>
</lightning-layout>
Here is my starting point at looping each record edit form, I am struggling to determine how I loop each field in each edit form and do the checks. Thank you!!
this.template.querySelectorAll('lightning-record-edit-form[data-id="IeForm"]')
.forEach((form) => {
console.log('here is the form ' + form);
});