Slinger's Thoughts

March 6, 2008

Custom New, Edit and Display forms for a list or document library.

Filed under: SharePoint — slingeronline @ 4:47 pm

I created a standard contacts list in our SharePoint portal the other day.  Seems simple enough.  There was one issue though.  Although it was not a column in the list, or part of any view, whenever I created a new item, or edited an existing item, there were some fields that displayed that our organization has absolutely no use for.  It showed, all the standard column entries, and any of the ones I added or edited were fine.  But the fields labelled “Phonetic Last Name,” “Phonetic First Name,” and “Phonetic Company Name,” don’t have a real use to us here.  No matter how hard I tried I couldn’t find a way to get rid of these fields, since they didn’t appear anywhere except on the New Entry page and the Edit page.  Time to fire up my SharePoint Designer.When you naviagate into your list in SPD, you will see a few pages there.  NewForm.aspx, EditForm.aspx, DispForm.aspx, and usually AllItems.aspx.  These are the standard pages for a list.  If you open one of these pages in SPD and look at the design view, you will see a rather generic Form Entry web part. It looks like this.

NewForm

Well, the names of my columns are not “Column Name 1”, “Column Name 2” and so on.  I didn’t see anywhere in the code for this webpart where I could edit the fields to get rid of those pesky “Phonetic” fields.  I need to change this webpart to one more fitting.  The first thing I did was to make a copy of the DispForm.aspx, NewForm.aspx and EditForm.aspx files.  These are the ones I will edit.  And you can edit all of them basically the same way to get the results you are looking for. 

The first thing to do is delete that pesky generic List Form Web Part.  Then click on Insert, SharePoint Controls, Custom  List Form. In the options window that appears, select the document library or list that you would like the form to be attached to, and the content type, and lastly you need to select what type of form this is, whether it it to create a new item, edit an existing item, or show the details of an item.

Form Options

This will create a form entry web part that displays all of the appropriate fields for your list or document library.  You can edit this form as you please, moving fields around, editing areas and so on.  Save page that you are working on once you have finished.  Now you have a form to edit the fields in your list that has only what you want and formatted the way that you want.  One thing to note.  When you use the new forms page, attachments no longer work correctly, so you probably don’t want to have the standard tool bar in the form. 

Now we need to make sure that the list or document library knows that it should use this page instead of the default.  In SPD navigate to where you can see all of your lists and document libraries.  Right click on the one that you would like to use the new forms pages you just created and select “Properties.”

EditList 

 On the “Supporting Files” tab, you can select which pages you would like to use for each form. Select the pages that you edited, and click apply.

ListOptions

 and then go check out your new pages. Go to your list, and create a new item.  When the page opens, you’ll be looking at your new form.

Advertisements

7 Comments »

  1. This is one of the best articles I have found for customizing a form, and I have used it successfully However, I found that when generating the Custom List Form for a Photo Library, the “new” form leaves off the Review or thumbnail portion of the form.
    Any ideas about how to fix this or add the preview separately?

    Comment by Sherry Robinson — May 5, 2008 @ 10:10 am

  2. I’ve not run into that issue, but I imagone it has something to do with the fact that atachments no longer work when you edit these form pages. As to why this is, I don’t know. I can only hope that Microsoft corrects it in a future hotfix or service pack.

    Comment by Slinger — May 5, 2008 @ 10:31 am

  3. Do you know how to create this via definition. I’ve created recently a custom allitems.aspx using deisigner.. how will I include this aspx page in the list once I have created the list thru schema? any idea?

    Comment by Totoy Bato — June 11, 2008 @ 2:19 am

  4. Sorry Totoy, I don’t do much with Site Definitions, as our implementation is relatively small. (One site collection.) There’s not much need for me to make those kind of changes.

    Comment by slinger — June 12, 2008 @ 10:58 am

  5. Document libraries do not have the option of specifiying a customized DispForm.aspx – anyone know of a way of using a custom DispForm.aspx in a Document or Picture Library??

    Comment by Marisa — July 10, 2008 @ 3:41 pm

    • Hi Marisa,I read your post and I would like understand if you’ve find a way to using a custom DispForm.aspx in a document or picture library.

      Have you news?

      Thanks

      Comment by Kekin — June 29, 2010 @ 7:43 am

  6. I’m really impressed with your writing skills as well as with the layout on your weblog.
    Is this a paid theme or did you customize it yourself?
    Either way keep up the nice quality writing, it’s rare
    to see a great blog like this one nowadays.

    Comment by where the wild things are — March 4, 2014 @ 5:52 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: