Tuesday, November 15, 2011

Invalid page URL” New Item in sharepoint

Suppose you use Microsoft Office SharePoint Designer to customize the NewForm.aspx page of a list in SharePoint, you connect to the list by using a Web browser.You may face any of the following issues.
  1. You click New to create a new item in the list. In this scenario, you may get the following error message “Invalid page URL:” a small JavaScript pop up window that appears on the screen.
  2. You get this error message “An unexpected error has occurred” when you click an existing item in the list.
  3. Additionally, you might view the properties of the list in SharePoint Designer 2007 and then specify the NewForm.aspx page in the New item form box. When you do this, the NewForm.aspx page appears to be saved as the new item form when you click OK. However, the next time that you view the properties of the list, the New item form box is empty.
Reason for the issue : This issue occurs if you deleted the List Form Web Part from the NewForm.aspx page.

Solution :

To resolve this issue

1) delete the list, and then re-create it. Then, customize the NewForm.aspx page. When you customize the NewForm.aspx page, make sure that you do not delete the List Form Web Part.
If you want to customize the controls that appear on the NewForm.aspx page, and if you do not want to show the default List Form Web Part, you can hide the List Form Web Part. To do this, follow these steps:
  1. Start SharePoint Designer 2007, and then open the NewForm.aspx page for the list.
  2. Right-click the List Form Web Part, and then click Web Part Properties.
  3. Expand Layout, click to select the Hidden check box, and then click OK.
OR

2) Restore the List form Webpart, refer : http://madhunomula.blogspot.com/2011/11/restore-list-form-web-part-for-editform.html

Restore list form web part for EditForm

Restore list form web part for EditForm

Yesterday I spent the whole day finding on the Internet about how to restore the list form web part of my edit form as I accidentally deleted it and could never get it back from the Closed web parts, nor could I get it back by resetting the file to site definition in Sharepoint Designer. It is really important to remember that the original edit form, display form and new form should never be deleted, but kept as hidden if we had to customise them.

What happened after I deleted my edit form, caused the edit link to disappear in the display page, nor could I edit properties of any item, or it will just redirect to the AllItems.aspx page. So, to retrieve the edit form back, what we do is:

1.In Sharepoint Designer, open the EditForm.aspx and DispForm.aspx. Grab a copy of both files and paste them in Notepad for backup.

2.On EditForm.aspx, go to Designer mode, click on the spot behind your own edit form, and go to Insert -> Sharepoint Controls -> Choose Edit item form, assign the right list in the dropdown on top. That should put back the original edit form. Designer will render it as error but that's okay.
3.Next, on DispForm.aspx, copy the Display Form web part code in code behind, and then back to EditForm.aspx, find the code which Sharepoint Designer just inserted for you (the original edit form), and paste the DispForm code there. Don't go to the Design mode now!
4.Change the ControlMode from Display to Edit.(Note: forNewForm change it to "New")
5.Change the FormType to 6.(Note: forNewForm change it to 8)
6.Save the page.

Try it on Sharepoint site to see if it is working. It should, if not then it's really cooked and you can try changing the Guid ID of the web part and ID.