I have created modal in component and added <force:inputField inside it, but it is not displayed on the modal popup.

enter image description here

But, if the same <force:inputField is added in the component, then it displayed on the component.

enter image description here


<aura:attribute name="contactOnAccount" type="Custom_Opportunity_Contact_Role__c" 
               default="{ 'sobjectType': 'Custom_Opportunity_Contact_Role__c' }"/>

<aura:if isTrue="{!v.editOCRModal}">
        <div aura:id="new-ocr" class="" style="">
            <div role="dialog" tabindex="-1"  class="slds-modal slds-fade-in-open">
                <div class="slds-modal__container main-modal-container slds-modal slds-fade-in-open">
                    <div class="slds-modal__header">
                        <div aura:id="new_ocr_setting_modal" class="slds-text-heading--small modal-header">New Priority Points Settings</div>
                        <div class="close_modal"> 
                            <lightning:buttonIcon iconName="utility:close" alternativeText="Close" iconClass="light" size="x-small" class="add_ocr" onclick="{!c.closeModal}" />
                    <div class="slds-modal__content slds-p-around--medium content">
                        <label class="slds-custom-label">Contact</label> 

                        <force:inputField aura:id="test_lookup_field" value="{!v.contactOnAccount.Contact__c}"/>

            <div class="slds-backdrop slds-backdrop_open"></div>

How to display force:inputfield on the modal popup?

  • Do you see any error in console? I literally copy pasted your code except for the SObject type here and it just works fine.
    – Jayant Das
    Jan 10 '19 at 17:48

Force:InputField / OutputField nested in aura:if will not render when default value is false For More Info...


Use aura:renderIf it will work. No other workaround

The difference being that aura:if instantiates the components in both the "if" and "else" attributes, but not both. aura:renderIf instantiates both, then only renders one.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.