I am trying to append a parameter like ID to a URL in a SP.UI.ModalDialog Popup
Question
I seem to be hitting a wall getting this to work. I can get the ModalDialog Popup to work but I have spent many hours trying to figure out how to pass a parameter over to the dialog box.
The Goal: Is to have the ProductID field to be used a parameter
The issue: For some reason When either or both of 2 lines from the code below is in the code, the button to open the dialog boxes ceases to work. These 2 lines
args: dialogArgs,
dialogReturnValueCallback: onDialogClosed,`
The two above when in the code stops the button form working.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="/_layouts/15/1033/styles/corev15.css"/>
<script type="text/javascript" src="/_layouts/15/init.js"></script>
<script type="text/javascript" src="/ScriptResource.axd?d=UpqI01Xk841N_9CuQ5wMNuq9zFYl9ThRGFK83kTirNaZpHlB_KtqOQsuq_rvbhkEoKzWx2eHmGUEVuRsRgkhBYN6G4P88iQ7E9317tHeeWCm7WNLlm-efogSztGRwHF4ALZSZgIi48GJ_F2nixLvqYT_d6nONKgdtAa-ZCAL7pf2SnblS9VJ1CfY9irxg7Kw0&t=ffffffffeea0dba9"></script>
<script type="text/javascript" src="/_layouts/15/sp.init.js"></script>
<script type="text/javascript" src="/_layouts/15/sp.ui.dialog.js"></script>
<script type="text/javascript" src="/_layouts/15/ScriptResx.ashx?name=sp.res&culture=en-us"></script>
</head>
<body>
<button type=button onclick="openDialog()">click me</button>
<div style="display:none">
<div id="d10">my dialog message</div>
</div>
<script>
function openDialog() {
var e = document.getElementById('d10');
var dialogArgs = {
itemID:e.id
var options = {
title: "My Dialog Title",
url : "url = "https://yourtenant.sharepoint.com/sites/publishing/product.aspx",
width: 400,
height: 300,
showClose: true,
allowMaximize: false,
autoSize: true,
**args: dialogArgs,
dialogReturnValueCallback: onDialogClosed,**
html: e.cloneNode(true)
};
SP.UI.ModalDialog.showModalDialog(options);
}
</script>
</body>
Once I got that working , what code should I use for the dialog please? Thanks in advance.
Solution
I came across this post that answered my question. Hope this helps someone else.
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange