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.

1 comment:

  1. Sachin,

    would I also be able to set the width of a textarea in the DispForm with this method?

    Marco

    ReplyDelete