at helper/controller<aura:iteration items="{!v.accList}" var="abc" indexVar="index">
<td>
<lightning:input aura:id="abc-start-date" name="accName" type="date" required="true" label="Date From" value="{!abc.Start_Date__c}" />
</td>
<td colspan="3">
<lightning:textarea aura:id="abc-comment" name="accComment" label="Comment" value="
{!abc.Comments__c}" placeholder="Comments"/>
</td>
</aura:iteration>
However, for multiple record it is failing as the abc-comment are multiple on the basis of list. Is there any way to put the validation message on the basis of record for which error/validation needs to be thrownfor (var i = 0; i < accList.length; i++) {
conditioncheck
component.find('abc-comment').setCustomValidity("Comments can't be blank.");
component.find('abc-comment').reportValidity();
}
1 risposta
Hi Ashima,You need to set aura:id unique for every iterating var, you can set it as:aura:id="{!index + 'abc-start-date'}"