Monday, March 8, 2010

Change Display Name of the column using JavaScript in New/Edit Form in SharePoint

Change Display Name of the column using JavaScript in New/Edit Form in SharePoint

 

<script type="text/javascript">
 

// this is default SharePoint function

//it will call after page is loaded.

_spBodyOnLoadFunctionNames.push("split");
 

//this function finds all &lt;nobr&gt; tag

//then check our original text and

//replace new text which contains <br>

function split()

{

var oP = document.getElementsByTagName('nobr');//the collection of <p> tags

for(var i=0;i&lt;oP.length;i++)

{

//alert(oP[i].innerHTML);

if(oP[i].innerHTML == "Location change Comments" || oP[i].innerHTML == "New Adjacencies Comments" || oP[i].innerHTML == "MD Presentation Comments"|| oP[i].innerHTML == "Product Missing From Floor Comments" || oP[i].innerHTML == "Overall Stock Issues Comments"|| oP[i].innerHTML == "Overall Quality of Visit Comments" || oP[i].innerHTML == "Overall Interaction with Management Comments")

{

oP[i].innerHTML = "Comments"

}

}

}

</script>

Original Post

0 comments: