I am using force:inputField in lightning component but it is not being rendered in the component. I am using compound form. If I replace force:inputField with ui:InputText or any other ui namespace component it shows up fine.

Below is the markup -

<aura:component controller="MyServerController" implements="force:lightningQuickActionWithoutHeader,force:hasRecordId">

    <ltng:require styles="/resource/SLDS0214/assets/styles/salesforce-lightning-design-system-ltng.css" />
    <!-- init event -->
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

    <aura:attribute name="newCustom" type="CustomObj__c" default="{ 'sobjectType': 'CustomObj__c' }" />
    <fieldset class="slds-form--compound">

        <div class="slds-form-element__group">
<div class="slds-form-element__row">    
                <div class="slds-form-element slds-size--1-of-2">
                    <label class="slds-form-element__label" >Custom field 1</label>
                    <force:inputField aura:id="field1"  value="{!v.newCustom.field1__c}"  required="true"/>
                <div class="slds-form-element slds-size--1-of-2">
                    <label class="slds-form-element__label" >Custom field 2</label>
                    <force:inputField aura:id="notes"  value="{!v.newCustom.field2__c}"  required="true"/>





Anything I am missing ?

  • Field names are case sensitive. Did you check to make sure the API name matches exactly?
    – sfdcfox
    Dec 15 '16 at 5:01
  • @sfdcfox , yes API names matches exactly and my custom obj is not null and fields are being initialized to non null values.
    – apn
    Dec 15 '16 at 5:06
  • @sfdcfox if I add ui:inputText on the next row in the form, it shows the input text box with value prepopulated correctly. Only the force:inputfield is not showing up
    – apn
    Dec 15 '16 at 17:37
  • I think that it is a bug. Force: inputField only renders when it is placed directly under a component tag. Can you try that..
    – manjit5190
    Dec 18 '16 at 6:45
  • @sfdcfox This is occuring for me when i used the component appera when Custom button in detail view of rec. and Action Type is set to Lightening component.
    – SFDC_Igle
    Feb 6 '17 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.