JavaScript Sharepoint Ajax List Data populater示例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript Sharepoint Ajax List Data populater示例相关的知识,希望对你有一定的参考价值。

function btnSubmitEntry_OnClick() {
   $('#contentLoading').show(); 
   var ourProperty = EscapeHtmlString($('#selProperty :selected').text());
   var ourAffectedUrl = EscapeHtmlString($('#selUrl :selected').text());
   var ourStagingUrl;
   
  if (ourAffectedUrl.indexOf('/') == 0) {
   		if (ourProperty.indexOf('MS.com') > -1) ourStagingUrl = "http://wwwstaging" + ourAffectedUrl;
   		else if (ourProperty.indexOf('http://') > -1) ourStagingUrl = "http://standards" + ourAffectedUrl;
   		else ourStagingUrl ="n/a";
   		}
   else if ((ourAffectedUrl == "new page") || (ourProperty == "talkstandards.com")) ourStagingUrl ="to be determined" ;
   else ourStagingUrl ="n/a"  ;
   
   var updateString = "<Batch OnError=\"Continue\">"; 
   updateString += "<Method ID=\"1\" Cmd=\"New\">"; 
   updateString += "<Field Name=\"ID\">1</Field>"; 
   //updateString += "<Field Name=\"Title\">" + EscapeHtmlString($("#txtTitle").val()) + "</Field>";
   updateString += "<Field Name=\"Title\">Bug or Change Request </Field>"; 
   updateString += "<Field Name=\"Property\">" + ourProperty + "</Field>"; 
   updateString += "<Field Name=\"Property_x0020_Owner\">" + getPropertyOwner($('#selProperty :selected').text()) + "</Field>"; 
   updateString += "<Field Name=\"URL_x0020_Affected\">" + ourAffectedUrl + "</Field>"; 
   updateString += "<Field Name=\"The_x0020_Requester\">" + EscapeHtmlString($("#txtAuthor").val()) + "</Field>";
   updateString += "<Field Name=\"staging_x0020_url\">" + ourStagingUrl + "</Field>";
   updateString += "<Field Name=\"Description\">" + EscapeHtmlString($("#txtDescript").val()) + "</Field>";
   updateString += "<Field Name=\"Priority_x0020_Level\">" + EscapeHtmlString($('#selPriority :selected').text()) + "</Field>";
   updateString += "<Field Name=\"Type_x0020_of_x0020_Request\">" + EscapeHtmlString($('#selType :selected').text()) + "</Field>";
   updateString += "<Field Name=\"Go_x0020_Live_x0020_Date\">" + EscapeHtmlString($("#txtGoLiveDate").val()) + "</Field>";
   updateString += "<Field Name=\"Go_x0020_Live_x0020_Time\">" + EscapeHtmlString($("#txtGoLiveTime").val()) + "</Field>";
   updateString += "<Field Name=\"PageSection\">" + EscapeHtmlString($("#txtSection").val()) + "</Field>"; 
   


    
 
   updateString += "</Method>"; 
   updateString += "</Batch>";
   try { 
   UpdateListItems("Change Requests", updateString, callback_Submit); }
   catch (err) {
   
   alert(err.message);
   
   }
   }	
   

function callback_Submit(respObj, status) {
   var soapError = SoapErrorCheck(respObj); 
   if (soapError.length == 0) {
      if (respObj.xml.length > 0) {
      var rows = $("z\\:row", respObj);
      requestID = trim($(rows[0]).attr("ows_ID"))
      
      var editUrl  = $("a#attachLink").attr("href") + "?ID=" + requestID;
      var attachmentUrl = $("a#custom-popup").attr("href") + "?ID=" + requestID; 
      
       $("a#attachLink").attr("href", editUrl );
      
      $("a#custom-popup").attr("href", attachmentUrl );
      
         $('#submittalConfirmation').show(); 
         $('#requestForm').hide(); 
         $('#contentLoading').hide(); 
         }
      else {
         alert("Error updating request list. Try again and if the error continues please contact your administrator."); 
         }
      }
   else {
      alert("Error submitting your request: \n" + soapError); 
      }
   }

以上是关于JavaScript Sharepoint Ajax List Data populater示例的主要内容,如果未能解决你的问题,请参考以下文章

JavaScript sharepoint绝对网站集URL javascript变量

如何从SharePoint列表创建javascript数组?

使用 JavaScript 更改 SharePoint 列上的下拉选项值

Sharepoint 2010 在 jquery/javascript 中捕获 webpart 刷新

javascript 获取SharePoint 2010/2013 userID

javascript SharePoint - 隐藏列表分组标题