Execute Javascript on Parent Form when Child form closes

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
charles267
Posts: 20
Joined: Wed Dec 23, 2015

06 Jul 2017

Hi there,

For a related item list, we are closing the child form using "SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.Cancel)" which closes the child form. We would, however, like to execute some javascript on the parent form after this child form closes. Any idea how this can be done? Thanks!

-Charles

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

06 Jul 2017

Hello, Charles!
Yes, there is a way to do it. Use JavaScript editor from the New Form of Child element and code similar to this:

Code: Select all

ExecuteOrDelayUntilScriptLoaded(function() { 
     
     //Here you can access all the elements from the Parent Form with this code:
    window.top.fd.field("Name of Your field")...
    
    //And this will close the dialog box after executing the code
    SP.UI.ModalDialog.commonModalDialogClose(0); 
     
}, "sp.ui.dialog.js");
Cheers

charles267
Posts: 20
Joined: Wed Dec 23, 2015

06 Jul 2017

Thanks so much! Will let you know how it goes.

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests