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

Record Edit Form
Hi,
Created a datatable to update the multiple records but this is not supported on the Mobile.
So I am iterating a record edit form and want to change the status of selected records to active.
How can i get this done.
Thanks
Created a datatable to update the multiple records but this is not supported on the Mobile.
So I am iterating a record edit form and want to change the status of selected records to active.
How can i get this done.
Thanks
Try this out :
<aura:iteration items="{!v.myList}" var="contact">
<lightning:recordEditForm aura:id="form"
recordId="{!contact.Id}"
objectApiName="CampaignMember"
onload="{!c.handleOnload}"
onsubmit="{!c.handleOnSubmit}"
class="slds-card__body_inner">
<div class="slds-box slds-theme_default">
<lightning:outputField fieldName="Name" />
<lightning:outputField fieldName="CompanyOrAccount" />
<lightning:outputField fieldName="Status" />
<lightning:input type="checkbox" aura:id ="checkbox" default= "false" value=“{!contact.isSelected}”/>
</div>
</lightning:recordEditForm>
<br />
</aura:iteration>
<lightning:button label="Attended" type= "submit" onclick= "{!c.handleOnSubmit}" />
<lightning:button label="Declined" type= "submit" />
COntroller
handleOnSubmit : function(component, event, helper) {
event.preventDefault();
Var myList = component.get(“v.myList”) || [];
Var selectedRecords = [];
for(var index=0;index<myList.length;index++){
if(myList[index].isSelected){
Var selectedContact = myList[index];
selectedContact. Status = “Attended”;
selectedRecords.push(selectedContact);
}
}
console.log(‘selectedRecords’+selectedRecords);
}
The selectedRecords contains the updated status contact records.
Cheers!!!!
All Answers
Can you post your current code status so that I can look into it to help you out.
Cheers!!!
The code is attached. Thanks
Try this out :
<aura:iteration items="{!v.myList}" var="contact">
<lightning:recordEditForm aura:id="form"
recordId="{!contact.Id}"
objectApiName="CampaignMember"
onload="{!c.handleOnload}"
onsubmit="{!c.handleOnSubmit}"
class="slds-card__body_inner">
<div class="slds-box slds-theme_default">
<lightning:outputField fieldName="Name" />
<lightning:outputField fieldName="CompanyOrAccount" />
<lightning:outputField fieldName="Status" />
<lightning:input type="checkbox" aura:id ="checkbox" default= "false" value=“{!contact.isSelected}”/>
</div>
</lightning:recordEditForm>
<br />
</aura:iteration>
<lightning:button label="Attended" type= "submit" onclick= "{!c.handleOnSubmit}" />
<lightning:button label="Declined" type= "submit" />
COntroller
handleOnSubmit : function(component, event, helper) {
event.preventDefault();
Var myList = component.get(“v.myList”) || [];
Var selectedRecords = [];
for(var index=0;index<myList.length;index++){
if(myList[index].isSelected){
Var selectedContact = myList[index];
selectedContact. Status = “Attended”;
selectedRecords.push(selectedContact);
}
}
console.log(‘selectedRecords’+selectedRecords);
}
The selectedRecords contains the updated status contact records.
Cheers!!!!
Hi Syed,
I am using your code but the isSelected is not catching any value and it comes out of the loop.
i have entered the console log command to check. Please update.
Thanks
When we check the checkbox and click Attended button then the controller is checking if the value of selected chek box is selected, if selected then the Status field should be changed to Attended.
But it look that the check box is not binding to the record, may be it need some binding.
I can't figure out this binding.
Thanks
Could you please change your attribute declaration to this :
<aura:attribute name = "myList" type = "Object[]"/>
Then try to debug,if still it doesn't work please attach your complete code so that I can help you.
Cheers!!!
Didi it work??
Your code worked the problem was with the lightning input
<lightning:input type="checkbox" aura:id ="checkbox" default= "false" value=“{!contact.isSelected}”/>
instead of this i changed to the ui button and it worked.
<ui:inputCheckbox text="{!contact.Id}" aura:id="boxPack" value="" />
Thanks