- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
简述:如何使默认的 SharePoint NewForm.aspx 添加一个项目并停留在输入页面而不是返回到 ListView AllItems?
长:
我被要求允许 SharePoint 用户在 SharePoint 列表中输入许多新项目,而不必在每次保存时返回到 AllItems。
此要求适用于许多列表,因此我不想为每种可能的内容类型开发特定代码。
我虽然可以编写一个简短的 js 文件并在用户想要保存并继续时使用它。
到目前为止,我尝试在内容编辑器 Web 部件 (CEWP) 中添加“保存并继续”行为。
我的第一种方法是更改 Source= 参数但没有成功(取消也返回到新源或在 preSaveAction() 中设置时忽略源。
然后我尝试在 preSaveAction 中设置表单操作:
<script type="text/javascript">
JSRequest.EnsureSetup();
var src = JSRequest.QueryString["Source"];
var exit = JSRequest.QueryString["exit"];
var isDialog = JSRequest.QueryString["IsDlg"];
var dlgParam = "";
if (isDialog)
dlgParam = "&IsDlg="+isDialog;
//If exit is defined its keeping default source parameter
if (exit) {
document.forms.aspnetForm.action= location.pathname+"?Source="+exit+dlgParam;
}
function PreSaveAction(){
//before saving the original source is saved in exit
exit=JSRequest.QueryString["Source"];
src=escapeProperly(window.location.protocol + '//' + window.location.host + _spPageContextInfo.serverRequestPath);
document.forms.aspnetForm.action=location.pathname+"?Source="+src+"&exit="+exit+dlgParam;
return true;
操作按预期更新,但在保存新项目时用户仍被重定向到 AllItems.aspx。
另一种尝试是添加一个特定的按钮,重复使用功能区和页面按钮中使用的 SharePoint javascript 操作
<script type="text/javascript">
function adressePage() {
return window.location.protocol + '//' + window.location.host + _spPageContextInfo.serverRequestPath;
}
function saveContinue() {
document.getElementById("cmdSaveContinue").disabled=true;
if (!PreSaveItem()) return false;
if (SPClientForms.ClientFormManager.SubmitClientForm("WPQ2")) {
SP.UI.Notify.addNotification("Saving ...", false);
window.location = adressePage();
} else {
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("cmdSaveContinue", "", true, "", adressePage(), false, true));
}
document.getElementById("cmdSaveContinue").disabled=false;
}
</script>
<input id="cmdSaveContinue" onclick="javascript:return saveContinue();" type="button" value="Enregistrer et continuer" style="top: -5.5em; position: relative;"/>
这样,处理表单验证并保存项目。
如果返回错误消息,表单将保留在 NewItem 上,但在执行 window.location=...
后错误消息将丢失。
当一切正常时,项目被保存并且用户在一个新的空 NewForm.aspx 上。
但是 SharePoint SPClientForms.ClientFormManager.SubmitClientForm("WPQ2")
是异步执行的,有时(不总是)重定向到AllItems 在我的重定向结束后出现。
我被困在这一点上,害怕在添加列表时被迫编辑 SPDesigner 中的每个 NewForm 页面...
信息:本地 SharePoint Server 2013,SPDesigner 可能
最佳答案
您可以通过 InfoPath 执行此操作,如果您拥有 SP on prem 和 SPDesigner 访问权限,则应该可以使用它。如果转到 InfoPath 并自定义表单,则可以转到“数据”>“提交选项”>(高级 >>)>“提交后”>“新建表单”。
您可以在谷歌上搜索“InfoPath Save and New”或转到 Microsoft 站点并查看 this演练。他们的演练建议使用两个按钮,其中一个打开新表单,另一个关闭表单。
关于javascript - 允许保存新项目并在 SharePoint NewForm.aspx 中继续,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29417632/
在 ASP.NET 编程的“代码隐藏”风格中,您将代码拆分为两个不同的文件:一个 .aspx 文件和一个 aspx.cs 文件。 (这适用于 C#;对于 VB,则为 aspx.vb。)每个人似乎都决定
在这个项目中你可以看到aspx文件下的aspx.designer.vb和aspx.vb 但是在我的项目中我没有它?? ,, 是什么赋予了?? 我可以通过右键单击然后单击查看代码来查看 vb 代码。 如
我将 my.aspx.cs 文件中的变量值传递到我的 .aspx 文件。当它在 aspx 中时,它的值会发生变化,然后需要返回到 .aspx.cs 文件。但是,它不允许我更改变量的值。有什么建议么?
我在 aspx 页面中使用多个 aspx 用户控件实例时遇到问题。当我尝试通过 Java 脚本获取用户控件元素值时会发生这种情况。 用户控制代码: function ucFun()
我有一个 asp.net 网站,我想知道是否可以将 .aspx 文件调用到另一个 .aspx 文件中。场景是我有 3 个左侧菜单,它们显示在各个页面上。 一开始我只有一个左侧菜单,因此将其添加到我的
我正在使用 C# 和 .NET ASP Web 应用程序开发我的第一个项目。我已成功连接到 SQL 数据库,但如何将输入从 .aspx(html 中)传递到 .aspx.cs(C# 中)? IE。(.
我已经阅读了很多关于同一问题的类似帖子,但这些修复对我不起作用。 我在页面代码的类区域中将变量声明为 Public,并在 Page_Load 子例程中为其分配一个值,但是当我在 javascript
在重命名不同的 ASPX 页面后,我曾多次遇到同样的问题,令我惊讶的是我在 stackoverflow 上找不到遇到同样问题的其他人。 当我运行我的 ASP.NET C# 项目时,调试器给我这样一条消
Select Zone East West North
这是我的 javascript 函数,其中值来自其他页面并且完美接收,但是如何在 cs 页面中检索“divConversation”值。这是我的代码 function myLoad() {
我不是编程新手,而是 Visual Studio、MVC、C#、ASP.NET 和 EXT.NET,即我尝试使用的所有工具的新手。 我正在尝试创建一个 Ext.Net 2.0 MVC4 项目,并获得了
我有一个 HTML 页面和一个 iframe(aspx 页面),如下所示。 Mypage.htm 此 Mypage.htm 将作为来自其他页面的链接提供,用户单击这些页面,Mypage.htm
我们最近设置了一个新的 SSRS 环境,报表的报表管理器 URL 现在为 Reports/Pages/Report.aspx 以前的环境是ReportList/Pages/ReportViewer.a
我正在尝试点击按钮,但我得到了 'ASP.views_home_index_aspx' does not contain a definition for'btnCreateOrder_Click'
我正在尝试将数据从 aspx.vb 页面传递到 aspx 页面。 在 aspx.vb 页面,我在 textbox 中放置了一个值(0 或 1),即 runat="server" 当加载 aspx 页面
我是 asp.net 的新手,正在处理一个有两个 .aspx 页面的问题集。 事件.aspx: 这是网站管理员在已经可用的面板(如事件标题、日期、信息等)的帮助下更新即将举行的事件和网络研讨会的地方。
这是我在 ASP.NET 中尝试执行的操作: 创建一个名为 Main.aspx 的页面。这个页面有一个 DIV 和一个按钮。 浏览器加载 Main.aspx。然后,当我单击该按钮时,我想将页面 Pag
我已经从一个不再可用的人那里继承了一个网站。在已部署的文件夹中,我有 Config.aspx(请参阅代码)。但是我找不到代码隐藏文件。配置页面有效。我在哪里可以找到 .cs 文件? 谢谢
我使用 iframe 来显示一个 aspx 页面,如下所示 this link 在 Displaypdf.aspx.cs 中,我正在显示一个 pdf,如下所示。我在
我的元素中有 2 个 aspx 文件。 first.aspx 页面上有一些内容,当我单击一个按钮时,它将在同一页面上启动一个框架(second.aspx 只有显示日历的代码)。 现在,一旦该日历 (s
我是一名优秀的程序员,十分优秀!