如何从脚本编辑器打开新项目表单 [英] How do I open new item form from script editor

查看:104
本文介绍了如何从脚本编辑器打开新项目表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在模态对话框中打开新项目表单。以下代码在SharePoint托管的应用程序中使用时非常有效,但由于某些原因在SharePoint页面上的脚本编辑器Web部件中不起作用。我的猜测是脚本文件没有正确加载。



I am trying to open the new item form in a modal dialog. The following code works perfectly when used in SharePoint-hosted app, but does for some reason not work in a script editor web part on a SharePoint page. My guess is that the script file doesn't load properly.

function openNewItemDialog() {

       var options = {
           url: appWebUrl + "/Lists/ListName/NewForm.aspx",
           width: 500,
           height: 500,
           title: "Form title"
       };
       SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
}





我会很感激帮助。



谢谢



I would appreciate som help.

Thanks

推荐答案

我发现了问题,我没有正确传递appWebUrl。
I found the issue, I didn't pass appWebUrl correctly.


这篇关于如何从脚本编辑器打开新项目表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆