Setting Project UID and Name in List Item Field

In a PDP we can have a list and clicking on new we would like to save Project UID and Name into list’s item fields. In the following code snippet, ProjUid and Owning Project are two SharePoint List Fields and they are being set by following js code.

<script src="/PWA/SiteAssets/jquery-1.10.2.min.js" type="text/javascript"></script><script type="text/javascript">

$(document).ready(function() {

 var Puid = window.parent.PDP_projUid;
 var project_name = window.parent.PDP_projName; 
 var subjectIDTextField1 = getElementByTitle("input","ProjUid");
 subjectIDTextField1.value = Puid; 
 var subjectIDTextField= getElementByTitle("input","Owning Project");
 subjectIDTextField.value = project_name; 
//Disabling field
 $(":input[title='Owning Project']").attr('disabled','disabled');

//Hiding field
var HidePUID = getElementByTitle("input","ProjUid");

function getElementByTitle(tagName,elementTitle)
	var list = document.getElementsByTagName(tagName);
	var elementTag;
	for (i=0;i!=list.length;i++) {
	if (list[i].title == elementTitle) {
	elementTag = list[i];
	return elementTag;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s