zoukankan      html  css  js  c++  java
  • 在Sharepoint2010中一种自定义调查列表的不允许再次答复提示的处理方法!

         在Sharepoint中默认创建的调查列表系统只允许答复一次,再次答复将报错误信息,这对最终用户而言是非常不友好的体验,当然你也可以在调查设置中的常规设置中设置允许多次答复,这样就会有错误提示信息,但有时实际业务场景只允许最终用户答复一次,不允许再次答复,因此非常有必要改进系统的重复答复错误提示信息,本文给出一种在调查列表中自定义的不允许再次答复提示的处理方法,通过Sharepoint列表Web服务和自定义的调查列表页面实现。如果允许多次答复可以按下图设置:

      如果不允许多次答复的,系统默认的报错信息如下图:

      通过自定义的报错提示如下图:

     

     核心的JS代码如下:

    $(document).ready(function() {
    
            var soapEnv =
                "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> 
                    <soapenv:Body> 
                         <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> 
                            <listName>食堂管理</listName> 
                            <viewFields> 
                                <ViewFields> 
                                   <FieldRef Name='ID' /> 
                               </ViewFields> 
                            </viewFields> 
                            <query> 
      <Query> 
    <Where> 
          <Eq> 
             <FieldRef Name='Author' /> 
             <Value Type='Integer'> 
                <UserID Type='Integer' /> 
             </Value> 
          </Eq> 
       </Where> 
     </Query> 
                </query> 
     <queryOptions> 
       <QueryOptions> 
          <RowLimit>1</RowLimit> 
       </QueryOptions> 
     </queryOptions> 
                        </GetListItems> 
                    </soapenv:Body> 
                </soapenv:Envelope>";
    
    
            $.ajax({
                url: "http://portal.contoso.uat/jx/_vti_bin/lists.asmx",
                type: "POST",
                dataType: "xml",
                data: soapEnv,
                async: false, 
                complete: processResult,
                contentType: "text/xml; charset="utf-8""
            });
        });
    
      function OpenDg() {
    		$( "#dialog-message" ).dialog({
    			modal: true,
    			buttons: {
    				确定: function() {
    					$( this ).dialog( "close" );
    				}
    			}
    		});
    	};
    
        function processResult(xData, status) {
             if(xData.responseText.indexOf("<z:row") <0)
             {                       
                $("#stgl").attr("href","/JX/Lists/Survey6/NewForm.aspx?Source=http://portal.contoso.uat/jx/SitePages/Home.html");
                return true;
             }
             else
             {
               $("#stgl").click(function(){
                 $('#dialog-message').empty();
    
                 $('#dialog-message').append("<p>对不起,您已填过<b>食堂管理</b>调查,不允许再次答复此调查!</p>");
                  OpenDg();
                  return false;
                });
    
             }
            
        }
    

    本博客为软件人生原创,欢迎转载,转载请标明出处:http://www.cnblogs.com/nbpowerboy/p/3655773.html 。演绎或用于商业目的,但是必须保留本文的署名软件人生(包含链接)。如您有任何疑问或者授权方面的协商,请给我留言。

     

  • 相关阅读:
    Memcached下载安装和使用
    PHP curl拓展的介绍和使用
    理解PHP面向对象三大特性
    empty()、isset()、is_null()的区别
    ThinkPHP无法打开或点击不了Trace的问题
    jQuery实现动态时间
    jQuery中$.get()和$.post()的异同点
    jQuery中attr()和prop()及removeAttr()和removeProp()的区别
    Windows10测试低版本IE方法
    apache 2.2 和 2.4 访问控制区别 (require 替代 deny)
  • 原文地址:https://www.cnblogs.com/nbpowerboy/p/3655773.html
Copyright © 2011-2022 走看看