Thursday, 10 March 2011

Howto use custom form for my custom content type

Today I needed to use custom form for New and Edit Action for a specified content type, here's how I've done that. As you can see, at the end I added XmlDocuments section and there I pointed to my form. The reason I have to done it that way is the fact, I needed to hide column "FileLeafRef" from user (it was done with javascript on my custom form).

<ContentType
ID="0x012000D58488ADD1F448949BF8127D3AB6699C"
Name="My name"
Description="My description"
Group="My Group"
>
<folder TargetName="_cts/Requests"/>
<fieldrefs>
<fieldref ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" Required="TRUE" DisplayName="Numer zgłoszenia" ShowInNewForm="FALSE" ShowInEditForm="FALSE" />
<fieldref ID="{8553196d-ec8d-4564-9861-3dbe931050c8}" Name="FileLeafRef" Required="FALSE" ShowInNewForm="FALSE" ShowInEditForm="FALSE" ReadOnly="TRUE" />
</FieldRefs>
<xmldocuments>
<xmldocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<formurls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<new>_layouts/Layouts/NewEditForm.aspx</New>
<edit>_layouts/Layouts/NewEditForm.aspx</Edit>
</FormUrls>
</XmlDocument>
</XmlDocuments>
</ContentType>

No comments:

Post a Comment