You need to sign in to do that
Don't have an account?
Martina Dimitrieva 2
lightning:recordEditForm with lightning:inputField
Hi,
I am getting following error while using lightning:recordEditForm with lightning:inputField, "Value for field 'NumberOfEmployees' is not a number: 123".
My code is this:
I am getting following error while using lightning:recordEditForm with lightning:inputField, "Value for field 'NumberOfEmployees' is not a number: 123".
My code is this:
<aura:component implements="lightning:actionOverride,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:lightningQuickActionWithoutHeader,force:hasRecordId" access="global" > <lightning:recordEditForm aura:id="edit" recordId="{!v.recordId}" objectApiName="Account" > <div aura:id="msg"> <lightning:messages /> </div> <lightning:inputField fieldName="Name" /> <lightning:inputField fieldName="Phone" /> <lightning:inputField fieldName="NumberOfEmployees" /> <footer class="slds-modal__footer"> <lightning:button variant="neutral" label="Cancel" onclick="{!c.cancelBtn}"/> <lightning:button aura:id="submit" label="Save" variant="brand" type="submit" /> </footer> </lightning:recordEditForm> </aura:component>Does anyone know how to fix it?
Hi,
Currently, all "int" fields will throw an error if you give them a value while using lightning:recordEditForm. I was able to come with a workaround:
Make a handler to onsubmit event of the form. This event is fired before dispatching the submit request.
You have access to all collected fields and values there which are to be submitted so you would find that field and cast it to an integer.
This will result in a successful save.Regards
All Answers
I would suggest you check for NumberOfEmployees field if it was created as number type or text type.
Best Regrads
NumberOfEmployees is a standard Salesforce field with type number. If you open the Account object in the developer console, the apexType for this field is int.
Regards
Hi,
Currently, all "int" fields will throw an error if you give them a value while using lightning:recordEditForm. I was able to come with a workaround:
Make a handler to onsubmit event of the form. This event is fired before dispatching the submit request.
You have access to all collected fields and values there which are to be submitted so you would find that field and cast it to an integer.
This will result in a successful save.Regards
short life (https://shortlife.co) online