1
votes

I'm looking to add a new field onto my NewForm.aspx, EditForm.aspx and DispForm.aspx pages in Sharepoint Designer 2007. I've managed to add a new textbox webpart and have edited the Common Textbox Tasks to make the Data Field my new field (Contacts..)

But how do I edit Edit.aspx and DispForm.aspx to display this new field?

I've looked around already answered questions on the site but I haven't run across what I'm really looking for -- sorry if I missed it!

Thanks! Shannon

5

5 Answers

1
votes

It doesn't count as "development", but wouldn't creating a new List column, Site Column or Content Type add this additional field to all your list forms just fine? How does this not work in your particular case?

0
votes

You have to use SharePoint Designer to access the site and edit those aspx (in the 'Forms' subfolder of the folder named after the list)

0
votes

You are probably going about this the wrong way. You should not need to change the edit and new forms for a list just because you want a new field. You do need to add the field to the underlying list and rely on the code in the forms to display the field correctly.

0
votes

IN SPD choose the Table tab on the far right, then Select a row, then you can Insert Above or Insert Below, then you can add your new field.

0
votes

New item, edit, and display forms aren't attached to lists so much as they attached to content types. If you can't use InfoPath or Designer to set these up, what you do is the following:

  1. Create the form in question as an application page. For whatever reason, SharePoint application pages won't render on-screen, so to get an idea of what I'm looking at I generally make them in a visual web part or separate ASP application first, then copy and paste the ASP/HTML over, then delete the original.

  2. In the case of edit and display forms, SP will pass you a query string with the ID in it. I capture the item in question thusly:

            NameValueCollection nvQueryString = Page.Request.QueryString;
            taskID = Convert.ToInt32(nvQueryString["ID"]);
            ViewState["TaskID"] = taskID;
    
            SPWeb thisWeb = SPContext.Current.Web;
            SPList taskList = thisWeb.Lists["Job Request approval tasks"];
            SPListItem taskItem = taskList.GetItemById(taskID);
    
  3. After adding on whatever it is you need to add on, you do need to add logic to the .cs page or a separate class that actually edits/adds the item in question. Probably pretty obvious...

  4. From here you have three options: either create an event receiver that points the editformURL/displayformURL/newformURL of the content type in question to your application page, create a brand new content type and add the URL for your application page in its XML definition, or add it manually via Powershell.