How to Get args from SP.UI.ModalDialog?
15,866
Use var args = window.frameElement.dialogArgs;
The article I used for reference.
Comments
-
Prisoner ZERO almost 2 years
I have tried other online suggestions without success.
So...
My function opening a SharePoint dialog passes
agrs
into the prescribedoption
object, like so:SETTING UP THE DIALOG:
Nothing magical here...function openEmailDialog() { var options = SP.UI.$create_DialogOptions(), url = '../Pages/EmailDocument.aspx'; options.title = "Email Documents"; options.width = 1024; options.height = 400; options.allowMaximize = false; options.url = url; options.args = { DidYouGetThis: true }; SP.UI.ModalDialog.showModalDialog(options); };
Next...
Upon opening the target URL, most online examples recommend the following JavaScript to extract the
args
BACK from the dialog, like so:GETTING THE ARGS:
Remember, this is JavaScript in a new page which was just opened as a dialog...$(document).ready(function () { // This fails because "get_childDialog" doesn't exist var args = SP.UI.ModalDialog.get_childDialog().get_args(); });
This fails because the
SP.UI.ModalDialog
object has noget_childDialog
function.