You need to sign in to do that
Don't have an account?
Tulasiram Chippala
[Cannot read property 'config' of undefined
Hi I am using ONSUBMIT event for validating fields using below code. Unfortunately I am getting an error
"[Cannot read property 'config' of undefined]"
Controller:
I dont knew why i am getting this error.
please help me on this. Thanks in advance.
"[Cannot read property 'config' of undefined]"
<lightning:recordEditForm aura:id="recordViewForm" objectApiName="Candidate__c" recordId="{!v.recordId}" recordTypeId="" onsubmit="{!c.onSubmit}" onsuccess="{!c.handleSuccess}" > <lightning:messages /> =================================================== <div class="slds-size_1-of-2 slds-max-small-size_1-of-1"> <lightning:inputField aura:id="endDateOnProject" fieldName="End_Date_on_Project__c"/> </div> <div class="slds-size_1-of-2 slds-max-small-size_1-of-1"> <lightning:inputField aura:id="reasonProjectEnded" fieldName="Reason_Project_Ended__c"/> </div> <div class="slds-size_1-of-2 slds-max-small-size_1-of-1"> <lightning:inputField aura:id="DummyField1" fieldName="" /> </div> <div class="slds-size_1-of-2 slds-max-small-size_1-of-1"> <lightning:inputField aura:id="Candidate-EndDate-NotifiedBy" fieldName="Candidate_EndDate_NotifiedBy__c" /> </div>
Controller:
onSubmit : function(component, event, helper) { var endDateProj = component.find("endDateOnProject"); var endDateProjValue = endDateProj.get("v.value"); console.log(endDateProj); var notifyBy = component.find("Candidate-EndDate-NotifiedBy"); var notifyByValue = notifyBy.get("v.value"); console.log(notifyByValue); if (endDateProjValue !== null){ notifyBy.set("v.errors", [{"message":"Quantity can’t be blank."}]); } },I am using code suggested by Salesforce Aura developer guide.
/*errorHandlingCustomController.js*/ { doAction : function(component, event) { var inputCmp = component.find("inputCmp"); var value = inputCmp.get("v.value"); // is input numeric? if (isNaN(value)) { inputCmp.set("v.errors", [{message:"Input not a number: " + value}]); } else { inputCmp.set("v.errors", null); } }, handleError: function(component, event){ /* do any custom error handling * logic desired here */ // get v.errors, which is an Object[] var errorsArr = event.getParam("errors"); for (var i = 0; i < errorsArr.length; i++) { console.log("error " + i + ": " + JSON.stringify(errorsArr[i])); } }, handleClearError: function(component, event) { /* do any custom error handling * logic desired here */ } }
I dont knew why i am getting this error.
please help me on this. Thanks in advance.