+ Start a Discussion
Tad Aalgaard 3Tad Aalgaard 3 

Accessing lightning:inputField value contained inside a lightning:recordEditForm from an Apex controller

I am using lightning:recordEditForm and lightning:inputField to create a lightning form which I can create a record with.  I am able to view lightning:input values but not lightning:inputField values inside of my Apex controller.  The only way I have found to pass these values is to add them to the Item via the JavaScript before I make the callout to my controller's save method.
if (component.find("spaceRequiresCleaning").get("v.value") != undefined) {
  item.Space_Requires_Cleaning__c = component.find("spaceRequiresCleaning").get("v.value");
To re-iterate, lightning:input values (from a text field) come accross without having to do the above.  While the lightning:inputField (picklist) needs the above code.
<lightning:input aura:id="cubeOfficeLocation" value="{!v.item.Cube_Office_Location__c}" label="Cube/Office Location" name="cubeOfficeLocation" size="10" type="text">

<lightning:inputField fieldName="Space_Requires_Cleaning__c" aura:id="spaceRequiresCleaning" name="Space_Requires_Cleaning__c" value="{!v.item.Space_Requires_Cleaning__c}">
I don't want to have to add the extra JavaScript for all my lightning:inputField tags in order to pass them to the Apex controller.  Any ideas on how to accomplish this another way?