4

I have created 'myUI.aspx' file @ /_layouts/myproject/myUI.aspx. This application page(aka LayoutPageBase) is used as a dialog across the farm just for creating new items in my list. As such I would also like to set it as the template for adding list items.

My custom list has a schema defenition where at the bottom I find

  <Forms>
           <Form Type='DisplayForm' Url='DisplayForm.aspx' SetupPath='pages\form.aspx' WebPartZoneID='Main' />
           <Form Type='EditForm' Url='EditForm.aspx' SetupPath='pages\form.aspx' WebPartZoneID='Main' />
           <Form Type='NewForm' Url='NewForm.aspx' SetupPath='pages\form.aspx' WebPartZoneID='Main' />
  </Forms>

Both the List definition & the layout file are in the same solution.

I have tried changing NewForm to each of the below:

  <Form Type='NewForm' Url='NewForm.aspx' SetupPath='_layouts\myproject\myUI.aspx' WebPartZoneID='Main' /> 

  <Form Type='NewForm' Url='NewForm.aspx' Path='_layouts\myproject\myUI.aspx' WebPartZoneID='Main' /> 

  <Form Type='NewForm' Url='NewForm.aspx' Path='layouts\myproject\myUI.aspx' WebPartZoneID='Main' /> 

Is there a way to do this or am I using the wrong kind of .aspx file?

  • Try <Form Type='NewForm' Url='_layouts\myproject\myUI.aspx' – Amal Hashim Nov 21 '14 at 16:18
  • I tried this before. It looks like the url attribute should only contains the file name, which the list form will get. Entering a path results in error Error occurred in deployment step 'Activate Features': The file or folder name contains characters that are not permitted. Please use a different name. – Fensterbank Nov 26 '14 at 13:29
  • so how did you manage to set it for creating new items? did you try to create a new list from that shema, maybe the existing list doesn't get the upgrade ? – Gwny Nov 26 '14 at 14:20
4

After analyse the trace logs, I found the solution (for my case).

The content of attribute Path is relative to the installation path of the feature, e.g.

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\FEATURES\myproject\MyListInstanceName\

The content of attribute Path is relative to the template path, e.g.

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\

So with

 <Form Type='NewForm' Url='NewForm.aspx' Path='_layouts\myproject\myUI.aspx' WebPartZoneID='Main' /> 

Sharepoint tried to load the file C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\_layouts\myproject\myUI.aspx which does not exist.

So the solution for your code is:

<Forms>
    <Form Type='DisplayForm' Url='DisplayForm.aspx' Path='LAYOUTS\myproject\myUI.aspx' WebPartZoneID='Main' />
    <Form Type='EditForm' Url='EditForm.aspx' Path='LAYOUTS\myproject\myUI.aspx' WebPartZoneID='Main' />
    <Form Type='NewForm' Url='NewForm.aspx' Path='LAYOUTS\myproject\myUI.aspx' WebPartZoneID='Main' />
  </Forms>

This means your last try must have been worked!

What was your error message? Did you look to the TraceLog, which file SharePoint tries to load?

2

have you tried using 15 hive in path?

<Form Type='NewForm' Url='NewForm.aspx' Path='_layouts\15\myproject\myUI.aspx' WebPartZoneID='Main' /> 
  • Yep, I tried it. This did not solved the problem. – Fensterbank Nov 26 '14 at 14:07
0

look at these links which explain how to do this:

http://www.codeproject.com/Articles/223431/Custom-SharePoint-List-Forms

http://thesharepointdive.wordpress.com/2012/03/20/list-forms-deployment-for-sharepoint-2010-part-1-of-4/

these applications are in SharePoint 2010 but works in SharePoint 2013, I tried it and it works.

I hope you find it useful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.