0

当用户尝试回答两次调查时,最好的响应是消息:“您不能再次回答此调查。” 但是我们中的一些人正在获得 ASP.NET 应用程序的标准“崩溃”屏幕。

这是一个配置项还是什么(我们在 SP2007 上)?

提前致谢...

4

1 回答 1

0

我最终通过使用此代码完全替换默认的“响应...”按钮处理程序来解决此问题,该代码用通知用户他已经完成调查的警报替换了任何重新进行调查的尝试。

$(document).ready(function() {  
    var myQueryOptions = "<QueryOptions />";
    //this was amazing: the value you need gets supplied by <UserID Type='Integer'/> (via Vadim Gremyachev)
    var myQuery = "<Query><Where><Eq><FieldRef Name='Author'/><Value Type='Integer'><UserID Type='Integer'/></Value></Eq></Where></Query>"; //find any instance of the current user
    var listPromise = $().SPServices({
        operation:  "GetListItems",
        listName: "{58ECDD94-8817-43A9-ACEC-42A1657E2F25}", //dev  Survey list
        CAMLViewFields: "<ViewFields><FieldRef Name='ID' /></ViewFields>",
        CAMLQuery: myQuery,
        CAMLQueryOptions: myQueryOptions
    });
    listPromise.done(function() {
        var iCount = $(listPromise.responseXML).SPFilterNode("rs:data").attr("ItemCount");
        if(iCount > 0) {
            $("[id*='_ctl00_toolBarTbl_RptControls_ctl00_diidIONewItem']").each(function() {
                $(this).attr("onclick", "");
                $(this).attr("href", "");
                $(this).on("click", function() {alert("You've already taken the survey!");});
            });
        }
        iCount++;
    });
    listPromise.fail(function() { alert("whoops");});
}); // $(document).ready()
于 2013-04-08T10:53:52.410 回答