Blog

Creating a custom list form with Sharepoint 2007

Today I ran in to an oddity with Sharepoint 2007.  Since the upgrade, users said the flow of creating a new entry for one of our lists wasn't very easy as everything was in a different order.  I went into the List Settings and updated the "column ordering" to match what they wanted.  However, this didn't update the order of fields when the users clicked on "new entry".  Isn't this how it worked in Sharepoint 2003?  I couldn't find an easy way to control the field order on NewForm.aspx so I started searching for how to customize it.  This took me to Jan Tielson's blog post which was a reference to Kristian Kalsing's great blog post.  This was exactly what I needed but I did hit a few parts that stumped me for a bit so I thought I'd post essentially the same steps with just a few warnings and extra details.

  1. Open your site in SharePoint Designer.
  2. Browse to your list and open the 'NewForm.aspx' web form.
  3. Go File > Save As... and give the form a new name such as 'NewForm2.aspx'.
  4. Delete the default List Form Web Part from the page.   So delete everything starting at and including <WebPartPages:ListFormWebPart......> down through and including </WebPartPages:ListFormWebPart>.  This should leave you with... 

    <WebPartPages:WebPartZone runat="server" FrameType="None" ID="Main" Title="loc:Main">
    <ZoneTemplate>


    </ZoneTemplate>
    </WebPartPages:WebPartZone>


  5. Save...(otherwise you'll be missing the "Custom List Form" option in the next step. )
  6. Put your cursor between <ZoneTemplate> and </ZoneTemplate> and then click Insert > SharePoint Controls > Custom List Form. (Note: Make sure you pick "Custom List Form" and not "List Form" or you won't be able to customize your form and then what's the point? <grin> )
  7. In the List or Document Library Form dialog, select the appropriate list, content type and type of form.
  8. Click OK. Now you'll have a new Data Form Web Part added with controls representing all the fields from the list
  9. Now you can make the customizations you want and Save your NewForm2.aspx.

That's it.  I found it's easier to me to change the view to "Code" and make my changes via HTML rather than the designer.  It's always stopping to update real-time and that left me waiting a lot.  You'll see that now it's really easy to cut and paste to reorder table rows.  After testing out your new form, if you want to make this the new default then...

  1. Right click on the root of your List  and select Properties.
  2. Click the Supporting Files tab and click Browse for the "New Item Form" value.
  3. Select "NewForm2.aspx", click OK
  4. Change the "Content type specific forms:" from Folder to "Item".  If you don't make this change, then "Supporting Files" changes won't actually save! 
  5. Click OK.

List Properties

That should do it.  Now when someone clicks on 'New Entry' it'll use your new custom form. This of course is the same process to update the Edit and Display forms as well. Thanks to Jan and Kristian for their blogs to get me going.  Hopefully this will help someone else if you're stuck.  Since all I wanted to do was change the order of the fields on a "New Entry", I'm not sure why all this was necessary and there's probably some easy way in the "settings" somewhere but until I find it...I hope this helps.

Return TopTrackbackPrintPermalink

Comments

Got something to say? Join the discussion »
    Posted @ 11/15/2011 8:35 PM by zee
    zee's avatar

    Nice post!
    zee
    http://walisystems.com

leave a reply

 [Quick Submit with Ctrl+Enter]

Remember my details
Notify me of followup comments via e-mail