Skip to main content

Blog

Go Search
Home
Blog
  

Categories
SharePoint
Other Blogs
There are no items in this list.
Team Site > Blog
Changing the layout of the New and Edit pages

Custom lists. Tips tricks and hacks

Creating a custom list is fairly easy. If you’ve been studying SharePoint for more the 30 seconds you would have figured out how to do it in the UI. The problem comes in when you demonstrate a custom list to a client and he says “that’s cool but, I want I really want is…” and now we start with read only fields, fields that default themselves to the current user profiles department or email or managers name. Additionally I commonly get requirements to extend the new or edit pages on an item. For example he may require that the title for an item be a read only with a given value. When a customer first came to me and asked me for these types of changes I never thought that it would have been as challenging as it actually was. It’s fairly easy once you know how but, it’s a difficult to pick up initially because the types of controls you need change don’t (always) conform to how you would expect them to. 

Over the next few articles I will attempt to show developers what I have learnt by others or figured out myself in order to develop a fully functional custom list.

 

Creating a modified newform

In order to customize the layout of a custom list Newform do the following steps

1)      Create a custom list with the fields you will need. Try to get all the fields you will need upfront because adding fields to a customized page can be a bit tricky.

a.       In this example I am going to create a custom list and add the following fields

Field Name

Type

Gamers Name

Person

Date Of Birth

Date Time

Game (renamed from Title)  

Text

Comments

Text (multiline)

email

Text

                

When we click the “New Item” button we get a Default new form that looks as follows

 

2)      Once you have created the list go into the SharePoint designer and open the site.

3)      In the tree view under lists you should see the list you just created.

4)      Expand the list so that you can see the newForm.

NB. The wrong thing to do is edit the new form. Doing so tends to mess up the list internally and causes problems.

5)      What you can do is make a copy of the page by right clicking on it  and pasting it on the list folder

6)      Rename the copied page to NewForm_Mod.aspx

7)      Open the page. You will notice that the web part cannot be changed so go ahead and delete it

8)      On the  top menu click insertàSharePoint ControlsàCustom Form List

9)      A dialog appears. In the first dropdown select the list we are working with. In this case we are dealing with an Item content type so leave it. Lastly we are modifying the New form so we want the new item. Click OK

10)   Now you can modify the table as you please in either in the code view or the design view

 

Extending Your Customization for the editForm

11)   Once you have completed the new form. Do steps 1 through to 6 and name your edit form editform_mod.spx

12)   Copy the sections of the modified asp that you changed in the new form

13)   Examine the controls you just copied change the controlmode to Edit and change the ‘I’ (for insert) to ‘u’ (for update)

Getting the list to look at your new asp pages

14)   At this point SharePoint will still look at the old NewForm.aspx and EditForm.aspx. We need to change it so that when we create a new item or modify an existing one, SharePoint routes us through to NewForm_mod.aspx and EditForm_mod.aspx. We do this by right clicking on the list and selecting properties.

15)   Under the supporting files tab select item under the specific content type.

16)   Now change the files to point from the original files to the new files.

 

 ‭(Hidden)‬ Admin Links