Okay, I am using lightning:recordForm to create a standard contact form in which I am redirecting on cancel and on success using lightning:navigation but since the layout in recordForm is not that good and since there is no such layout like standard. Now, I am thinking to use modal window but I guess I cannot use lightning:recordForm . Am I wrong ?
Can someone please correct me ?
<aura:component >
<aura:attribute name="accountId" type="String" />
<aura:attribute name="recordId" type="String" />
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
<lightning:overlayLibrary aura:id="popuplib"/>
<aura:attribute name="url" type="String"/>
<lightning:navigation aura:id="navService"/>
<aura:attribute name="pageReference" type="Object"/>
<aura:attribute name="fields" type="String[]" default="['Account__c']" />
<lightning:notificationsLibrary aura:id="notifLib"/>
<lightning:recordForm
objectApiName="Lead"
recordTypeId = 'xxxxxxxxxxx'
recordId="{!v.recordId}"
fields="{!v.fields}"
layoutType="Full"
mode="edit"
onsuccess="{!c.handleSuccess}"
oncancel="{!c.onCancel}"/>
</aura:component>
Best Answer
You can use the
lightning:overlayLibrary
to create the modal and dynamically call your custom component.Examples taken directly from the documentation and will work if your aura component is called
modalContent
:MyComponent.cmp
MyComponentController.js