Quantcast
Channel: Active questions tagged lightning-experience - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 3020

recordEditForm : event.preventDefault() not submitting the pre populated values in the form

$
0
0

I have a custom aura component for record creation. The onload() function calls the apex method to load values in the form. When I try to submit the form by using onsubmit(), the new record is created but its not showing the pre populated values on the new record created. I tried using event.preventDefault() and manually setting the field values in the onsubmit() handler, its not submitting the form, neither its creating a record, it throws an error saying that the record already exists with the lookup values.

In the form I'm doing the following lines of code to capture the values:

<lightning:inputField aura:id = "candidateSummaryField" feildName = "Candidate_Summary__c" /><lightning:inputField aura:id = "stageField" fieldName = "Stage__c"/>

In the controller in the onload() handler:

var stageFieldValue = component.find("stageField").set("v.value", "Contacted");var candidateSummaryFieldValue = component.find("candidateSummaryField").set("v.value", result[0]['Candidate_Summary__c']);

In the controller in the onsubmit() handler:

handleSubmit : function(component, event, helper) {        console.log("Inside handleSubmit");        event.preventDefault();        var fields = event.getParams('fields');        console.log("fields::::: "+JSON.stringify(fields));        fields['Candidate_Summary__c'] = 'New Candidate Summary';        fields['Stage__c'] = 'Contacted';        component.find("applicantForm").submit(fields);    }

Kindly suggest what I might be missing here, which is not allowing me to achieve record creation with already pre populated values from the form.

Thanks!


Viewing all articles
Browse latest Browse all 3020

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>