Showing posts with label submit. Show all posts
Showing posts with label submit. Show all posts

Monday, February 11, 2013

Sharpeoint internal names display..

<select id="spLists" onchange="displayFieldData(this.options[this.selectedIndex].value)"/>
<div id="spListsSelected"></div>
<table id="spListFieldTable" cellpadding="0" cellspacing="0" style="width: auto"></table>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
var siteURL = 'http://' + window.location.host + L_Menu_BaseUrl + '/_vti_bin/lists.asmx';
$(document).ready(function(){
 var soapEnv = "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
     <soap:Body> \
     <GetListCollection xmlns='http://schemas.microsoft.com/sharepoint/soap/' /> \
     </soap:Body> \
     </soap:Envelope>";
 $.ajax({
  url: siteURL,beforeSend: function(xhr) {
   xhr.setRequestHeader("SOAPAction",
   "http://schemas.microsoft.com/sharepoint/soap/GetListCollection");
  },
  type: "POST",
  async: false,
  dataType: "xml",
  data: soapEnv,
  complete: processResult,
  contentType: "text/xml; charset=\"utf-8\""
 });
});
function processResult(xData, status) {
 $("#spLists").append("<option>Select a List</option>");
 $(xData.responseXML).find("List").each(function() {
 var liHtml = "<option value='" + $(this).attr("Title") + "'>" + $(this).attr("Title") + "</option>";
 $("#spLists").append(liHtml);
 });
}
function displayValue(splistname) {
 $("#spListsSelected").text(splistname);
}
</script>
<script type="text/javascript">
var arrSkipFieldTypesOf = ['Computed'];
var arrIncludeOverrideFields = ['Title','Author','Created','Modified','Editor'];
function displayFieldData(listname) {
 if(listname == "" || listname == undefined) return false;
 var soapEnv = "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'> \
     <soap:Body> \
     <GetList xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
     <listName>" + listname + "</listName> \
     </GetList> \
     </soap:Body> \
     </soap:Envelope>";
 $.ajax({
  url: siteURL,
  beforeSend: function(xhr) {
  xhr.setRequestHeader("SOAPAction",
  "http://schemas.microsoft.com/sharepoint/soap/GetList");
  },
  type: "POST",
  async: false,
  dataType: "xml",
  data: soapEnv,
  complete: processResult2,
  contentType: "text/xml; charset=\"utf-8\""
 });
}
function processResult2(xData, status) {
 $("#spListFieldTable tr").remove();
 $("#spListFieldTable").append("<tr style='font-weight:bold;'><td style='padding-right:10px'>DisplayName</td><td style='padding-right:10px'>FieldInternalName</td><td style='padding-right:10px'>FieldType</td></tr>");
 $(xData.responseXML).find("Field").each(function() {
  if (($.inArray($(this).attr('Name'),arrIncludeOverrideFields)>-1) || ($(this).attr('FromBaseType')!='TRUE' && $(this).attr('Sealed')!='TRUE' && $(this).attr('DisplayName')!=undefined && $.inArray($(this).attr('Type'),arrSkipFieldTypesOf)==-1)) {
   var trHtml = "<tr>";
   trHtml += "<td style='padding-right:10px'>" + $(this).attr("DisplayName") + "</td>";
   trHtml += "<td style='padding-right:10px'>" + $(this).attr("Name") + "</td>";
   trHtml += "<td style='padding-right:10px'>" + $(this).attr("Type") + "</td>";
   trHtml += "</tr>";
   $("#spListFieldTable").append(trHtml);
  }
 });
 $("#spListFieldTable tr:odd").css("background-color","rgb(206,206,206)");
}
</script>

Thursday, August 02, 2012

Show ID in Sharepoint Edit Page using javascript

multiple Javascripts from one trigger

<input name="Button1" type="button" value="Submit" onclick="javascript: {ddwrt:GenFireServerEvent('__commit;__redirect={/thanks-for-submission.aspx}')}" />



Show ID Column from CEWP

<script type="text/javascript"> 
 // Item ID in DispForm.aspx and EditForm.aspx 
// Feedback and questions: Christophe@PathToSharePoint.com 
// 
function DisplayItemID() 

var regex = new RegExp("[\\?&]"+"ID"+"=([^&#]*)"); 
var qs = regex.exec(window.location.href); 
var TD1 = document.createElement("TD"); 
TD1.className = "ms-formlabel"; 
TD1.innerHTML = "<h3 class='ms-standardheader'>Issue ID</h3>"; 
var TD2 = document.createElement("TD"); 
TD2.className = "ms-formbody"; 
TD2.innerHTML = qs[1]; 
var IdRow = document.createElement("TR"); 
IdRow.appendChild(TD1); 
IdRow.appendChild(TD2); 
var ItemBody = GetSelectedElement(document.getElementById("idAttachmentsRow"),"TABLE").getElementsByTagName("TBODY")[0]; 
ItemBody.insertBefore(IdRow,ItemBody.firstChild); 

  
_spBodyOnLoadFunctionNames.push("DisplayItemID"); 
</script>

Followers

No Locks without Key

🌿 Bible Verse 1 Corinthians 10:13 "No temptation has overtaken you except what is common to mankind. And God is faithful; ...

Who Am I?

My photo
What is mankind that you are mindful of them, human beings that you care for them? Psalms 8:4 But he made us a little lower than Angels and Crowned with Glory and Honor. How majestic is your name in all the Earth Oh Lord our God!