1

This is for a custom Editform.aspx being used to submit data to a custom list. Once the user completes the form, he should be able to hit a button or even the OK button, and have sharepoint submit the form data to the list, then redirect to the items Display form (dispform.aspx?ID='itemid'). I was able to get the ID of the current item by manipulating document.location.href. I tried to do a postback in javascript using __doPostBack with __commit and __redirect (redirecting to the URL displayform?ID='itemid'), but when the redirect happens, I see that the changes were not updated!

Anyone able to do something like this?

4

2 回答 2

1

通过修改 Source 查询字符串参数中的 URL,您可以让表单在发布后重定向到任何位置。使用 javascript,您可以在该查询字符串参数中查找特定 URL (/location/dispform.asp?ID=),如果它不存在,则将页面重定向到自身,但将 Source 参数填写到位置 w / 您要将它们发送到的 ID。

最难的部分是在 javascript 中解析当前的 URL + 参数。我发现有一些 JS 代码片段可以让它变得更容易。

以这种方式重写 EditForm URL 的好处之一是取消按钮会将用户发送到 DispForm 页面,而不是他们最初来自的页面,尽管大多数人可能使用后退按钮。

于 2009-11-13T03:14:11.683 回答
0

这导致我解决了我的表单操作问题,DispForm它不会将列表项 ID 带到 custom EditForm。以下最终为我工作:

onclick="javascript: {ddwrt:GenFireServerEvent(concat('__redirect={ProgEditForm.aspx?ID=+',$ListItemId,'}'))}"

我有一个DispForm参数的ListItemID地方

参数来源:查询字符串
查询字符串变量:ID
默认值:0

希望对其他人有所帮助,因为这几乎让我发疯了!

于 2015-08-19T20:40:16.090 回答