Needing guidance on using a prebuilt lightning:recordeditform. I can't seem to get this to save the updates back to the record but can't see anything different when looking at similar solutions. Help would be greatly appreciated.
Controller:
handleSubmit : function(cmp, event, helper) {
var fields = event.getParam("fields");
component.find('updateSettingForm').submit(fields);
Form:
<lightning:recordEditForm
aura:id="updateSettingForm"
objectApiName="AppSetting__c"
recordId="{!v.appset.Id}"
onsubmit="{!c.handleSubmit}">
<lightning:inputField fieldName="ConfigurationType__c" readonly="false"/>
<lightning:inputField fieldName="Method__c" />
<lightning:button variant="brand" label="SAVE" type="submit"/>
</lightning:recordEditForm>
v.appset.Id is being populated via an Apex Class and passed back through an Init on load. This is working fine as the data from the EXISTING record is showing on the form as found within the queried record. When updating any field on the form it fails to commit back to the database.
onsubmit="{!c.handleSubmit}"
and its corresponding code, if you are not going to check the user inputs and manipulate the values before submitting data.lightning:button
oftype="submit"
should be enough to submit data. On the contrary, if you have some additional code withinhandleSubmit
method, please includeevent.preventDefault()
as its first line. This will stop the data from being submitted untill your code explicitly calls.submit(fields)
. Check if havingevent.preventDefault()
solves your problem. Your code doesn't seem to have any other issues.