• Xovo Larjem
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I am trying to display below lightning form in modal popup using overlay library. Please let me know how to do. 
I have overrided below form with Contact New button. Thanks.
    
    <aura:component implements="force:appHostable,lightning:actionOverride" access="global" >
    <aura:attribute name="recordId" type="String" /> <lightning:overlayLibrary aura:id="popuplib"/>
    <div class="slds-p-bottom_large slds-p-left_large" style="width:500px">
        <lightning:recordEditForm objectApiName="Contact" onsuccess="{!c.handleSuccess}">
            <lightning:messages />
            <lightning:inputField fieldName="FirstName" />
            <lightning:inputField fieldName="LastName" />
            <lightning:inputField fieldName="Birthdate" />
            <lightning:inputField fieldName="Phone" />
            <lightning:button aura:id="submit" type="submit" label="Save record" class="slds-m-top_medium" />
            </lightning:recordEditForm>
    </div>  
</aura:component>

Client side controller:

({
    handleSuccess : function(component, event, helper) {
        
        var contactRec = event.getParams().response;
        var navEvt = $A.get("e.force:navigateToSObject");
        navEvt.setParams({
           "recordId": contactRec.id,
           "slideDevName": "related"
       });
        
       navEvt.fire();
    }  
})
Visualforce page:
<apex:column > <apex:commandLink action="{!deleteItem}" reRender="frmList"  oncomplete="updateCarts();"> Remove</apex:commandLink></apex:column>
JAVASCRIPT:
<script>      
         function updateCarts(){  
            var listId = "{!ids}";
             alert(listId);
            
        } 
        </script>

Controller
public string ids { get; set;}
public CartsController()
  { 
   ids= 'ABCDEF';   
  }
  public void deleteItem()
  {
    ids='123456';
  }

Result : updateCarts had call before action and show alert : 'ABCDEF';

How can javascript after action complete?