Execute Javascript on Parent Form when Child form closes
-
- Posts: 20
- Joined: Wed Dec 23, 2015
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
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
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 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:
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
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests