Jun 29 2017 09:27 AM
Hi, I was trying to write some js code for modal window using
function OpenDialog(url) { var options = SP.UI.$create_DialogOptions(); options.url = url; options.width = 769; options.height = 500; SP.UI.ModalDialog.showModalDialog(options); }
However, the page works fine in edit mode but when i publish the code does not seem to work.
Could you please let me know, how get around it.
Thanks
Jun 29 2017 10:22 AM
If I recall, when you're in edit mode, additional scripts are loaded into the page that may not be present in presentation mode. Can you confirm SP.js and SP.UI.Dialog.js are loading on the page when you're out of edit mode?
Jun 29 2017 06:21 PM
use SP.SOD.loadMultiple to ensure 'sp.ui.dialog.js' is loaded before using modal dialog.