Tuesday, February 5, 2013

Hide fields from SharePoint NewForm, DispForm and EditForm pages


Hi All,

Please find below Jquery script to hide the fields from NewForm.aspx, DispForm.aspx and EditForm.aspx page of SharePoint list

Hide fields from EditForm and NewForm


<pre class="brush: js">

$(document).ready(function() { 
$('nobr:contains("Recurrence")').closest('tr').hide(); 
$('nobr:contains("Location")').closest('tr').hide();
}); 


</pre>


Hide Fields from DispForm page

<pre class="brush: js">


$(document).ready(function() {

// Method #1: Access by FieldName – All fields have unique FieldNames
$('td.ms-formlabel:contains("Location")').parent().hide();

// Method #2:  Access by ID – NOTE: Not all fields have unique IDs
$('tr:has(td[id=SPFieldRecurrence])').not('tr:has(tr)').hide();
});

</pre>


Please refer to the link for more detail information.

Thanks,

Sachin K.

No comments:

Post a Comment