Javascript 如何在来自不同网站集的 SharePoint 2010 页面的模式对话框中打开新建列表项表单

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14384513/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 16:36:26  来源:igfitidea点击:

How to open New List Item Form in modal dialog in a SharePoint 2010 page from different site collection

javascriptsharepointsharepoint-2010modal-dialogsharepoint-designer

提问by Eedoh

I need to open a new list item form on hyperlink, or button click, in a Sharepoint 2010 page. The page and the list are in different site collections. I must do this from the Sharepoint Designer, or directly editing the page in a browser, Visual studio project is not possible/allowed...

我需要在 Sharepoint 2010 页面中的超链接或按钮单击上打开一个新的列表项表单。页面和列表位于不同的网站集中。我必须从 Sharepoint Designer 执行此操作,或直接在浏览器中编辑页面,Visual Studio 项目是不可能/不允许的...

Can this be done, and how?

这可以做到吗,怎么做?

回答by Jignesh Rajput

P.S. Most safe way to address New form is to use ListForm.aspx page, as follows:

PS 最安全的处理New form的方式是使用ListForm.aspx页面,如下:

 /_layouts/listform.aspx?PageType=8&ListId={PUT-LIST-GUID-HERE}

(PageType value goes from PAGETYPEenumeration)

(PageType 值来自PAGETYPE枚举)

i think you should be work when use PAGE_NEWFORMDIALOG : New form for a file dialog box.Value=9as describe on msdn. if New form is not open on model pop up than

我认为您应该按照PAGE_NEWFORMDIALOG : New form for a file dialog box.Value=9msdn 上的描述使用。如果新表单未在模型弹出时打开,则

Try this :

尝试这个 :

HyperLink

超链接

 <a href='javascript:;' onclick='Opendialog()'>New Item</a>

Opendialog is Javascript Function

Opendialog 是 Javascript 函数

   function Opendialog() {
       var options = SP.UI.$create_DialogOptions();
       options.resizable = 1;
       options.scroll = 1;
       options.url = SiteURLWhichExistList + "/_layouts/listform.aspx?PageType=8&ListId={PUT-LIST-GUID-HERE}";
       options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
       SP.UI.ModalDialog.showModalDialog(options);
   } 

Note : SiteURLWhichExistListpass your site collection url in where your list exist.

注意:SiteURLWhichExistList在您的列表所在的位置传递您的网站集 url。

Hope it helps!!

希望能帮助到你!!