Hacking EditForm.aspx

_SP2007

Sometimes you don’t want users to see all fields in the edit window (EditForm.aspx or NewForm.aspx).
To hide certain fields add a Content Editor Webpart and add the following script. Modify the hideFields() function to meet your needs.

Note: To make sure you are grabbing the correct fieldname always check in the sourcecode of the page. Sometimes the names can be different from what you see in SharePoint.

<script type=”text/javascript”>

_spBodyOnLoadFunctionNames.push(“hideFields”);

function findacontrol(FieldName) {
var arr = document.getElementsByTagName(“!”);
for (var i=0; i < arr.length; i++) { if(arr[i].innerHTML.indexOf(FieldName) > 0) {
return arr[i];
}
}
}

function hideFields()
{
var control = findacontrol(“Field Name“);
control.parentNode.parentNode.style.display=”none”;
etc.

}
</script>

Also consider the “Remove Title field” hack. This one lets you select fields in SharePoint and hide them! In some situations probably a cleaner solution. 

Source: http://sharepointsherpa.com/2008/08/26/sharepoint-2007-hiding-fields-on-newformaspx-and-editformaspx-the-easy-way/

Is this Pages usefull? Usefull Useless 0 of 0 people say this Pages is usefull.