Return to Snippet

Revision: 27660
at June 19, 2010 03:36 by rumremix


Initial Code
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); 
      }
   }

Initial URL

                                

Initial Description

                                

Initial Title
Sharepoint Ajax List Data populater Example

Initial Tags
ajax, javascript, list, update, sharepoint

Initial Language
JavaScript