I have a publishing page with a button users can click to launch a new list item form in a modal pop-up. It works great but I'm trying to add a page refresh after they click Save so they can see their posting and not end up re-submitting it. If they close it without saving the page should not refresh.
Here's what I've put together so far. It opens the form and posts the new list item just fine. It's only the page refresh that's not working. What am I missing?
<script>
var formOptions(pageUrl) = {
url: pageUrl,
title: 'Post New Classified',
allowMaximize: false,
showClose: true,
dialogReturnValueCallback: function(result){
if (result == SP.UI.DialogResult.Save) {
SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.Save);
}
if (result == SP.UI.DialogResult.cancel) {
//do nothing, modal was closed
}
}
};
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', formOptions);
</script>
<p align="center">
<a href="#" class="btn btn-primary" role="button" target="_self" data-toggle="tooltip" data-placement="bottom" title="Post a New Classified" style="font-weight: bold; color: #ffffff !important;" onclick="openDialog('https://mysite.sharepoint.com/testing/Lists/Classifieds/NewForm.aspx');">Post a New Classified</a>
</p>