SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a series of fields that I would like NOT to appear in my list dispForm.aspx. So when a user creates a new list item if these fields are unpopulated the do not appear DispForm.aspx but I still need the EditForm.aspx to show all fields.

I know OOB I am able to hide the list item under content type...this is not what i am looking to achieve.

Is there a way to achieve this with calculated values? ISBLANK (not familiar with the syntax)

Is anyone aware of a solution.

Have tried caml queries such as listed in other posts

"<View><Query><Where><IsNotNull><FieldRef Name="ContentType"/></IsNotNull></Where></Query></View>"

As well as

"<View><Query><Where><Eq><FieldRef Name="ContentType" /><Value Type="Text">Document</Value></Eq><And><IsNotNull><FieldRef Name="ContentType" /></IsNotNull><Neq><FieldRef Name="ContentType" /><Value Type="Text">Document</Value></Neq> </And> </Where></Query></View>"
share|improve this question
up vote 1 down vote accepted

Insert the following js-code into your DispForm.aspx with SharePoint Designer:

<script type="text/javascript">
  $(function() {
    $.each($(''), function() {
      if (!$(this).text().replace(/\xA0/,' ').trim()) {

You also have to included JQuery-library into DispForm.aspx or master-page.

share|improve this answer
Dmitry - thanks heaps for the code snippet - looks just to be just what I need. I will need sum assitance as to where to load the min.js. thanks – garvon-77 Jun 21 '13 at 3:52
I have added the above script and the script link tag to the DispForm.aspx - I do not see any changes - Do you think it is a misplacement of the script or the link - script link reads as follows: <SharePoint:ScriptLink runat="server" Name="/SiteAssets/js/jquery-1.10.1-min.js" Localizable="false"/> – garvon-77 Jun 24 '13 at 22:20
Hello, please, try to include jquery-library by using simple html tag: <script language="text/javascript" src="/SiteAssets/js/jquery-1.10.1-min.js" ></script> – Dmitry Kozlov Jun 25 '13 at 13:17
Thanks Dmitry - still not have any luck with the solution - not hiding any empty fields. Any other suggestions? – garvon-77 Jun 26 '13 at 1:56
Which version of SharePoint do you use? – Dmitry Kozlov Jun 26 '13 at 11:59

You can write a httpmodule, and do something like this:

 private void context_PreRequestHandlerExecute(object sender, EventArgs e)
            Page handler = (Page) HttpContext.Current.Handler;
            string rawUrl = HttpContext.Current.Request.RawUrl;
            if (rawUrl.Contains("/DispForm.aspx?"))
                handler.Load += new EventHandler(this.page_Load);//remove those fileds you want to hide in page_Load function.
share|improve this answer
Thanks Raymond - unable to do at this time - do not have a VS project setup (VS installed for that matter). I was hoping to achieve this with caml, jquery or calculated value. Any other suggestions? – garvon-77 Jun 20 '13 at 5:31
I have encountered a problem with my request. The series of fields I do not want to display are not in the DispForm.aspx but in the modal dialog - I was under the impression the DispForm.aspx drove the modal dialog output. I dont think this is correct. Can someone advise please. – garvon-77 Jun 24 '13 at 22:47

Yes you can do similar with jQuery. Using SPD you can edit the lists DisplayForm.aspx and add in the script you need to hide the field if it is empty.

Getting the correct field can be a bit of a challenge as it is a dynamically created form - I usually use the attribute "title" which contains the display version of the column name. The downside to this is that if you change the display name you need to change your script. Click F12 in IE to get developer mode and you will be able to see the structure of the HTML in the form.

EDIT: Code snippet as requested


You will need to check what sort of input/textarea/select etc your fields are and then use the column name to identify them.

share|improve this answer
I have updated my answer with a snippet as requested. This is using jQuery so you will also need the jQuery library active though you could also convert it to javascript if you prefer. – Dave Paylor Jun 21 '13 at 10:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.