To continue the conversation with the modal pop up window, I was asked the following great question:
“What if your list has different content types, each having their own form? Is there a way to make this pop-up specific to the form of a certain content type?”
The answer is yes it is quite easy to link the pop-up modal window to a unique content type: You would use the same approach but you would add in the Content Type ID to the end of the URL string:
<a onclick="javascript:NewItem2(event, "http://sitename/_layouts/listform.aspx?PageType=8&ListId={49E3BDCF-9C06-413D-A7B8-413F2E8F6B0D}&ContentTypeId=0x01005C9243AA25668B4CAACB42C41B0D360600052ECA5C1544864D9F9B7BF90A874A4F&RootFolder=");
javascript:return false;"
href="/_layouts/listform.aspx?PageType=8&ListId={49E3BDCF-9C06-413D-A7B8-413F2E8F6B0D}&ContentTypeId=0x01005C9243AA25668B4CAACB42C41B0D360600052ECA5C1544864D9F9B7BF90A874A4F&RootFolder="
target="_self">
Add a Unique Content Type Item</a>
To find the custom content type ID, simply click on the list settings, within the content type section right click on the custom content type and then click on properties. Within the Address URL, the ID is at the very end after the “ctype=”
Simply Replace the above blue ID with your own custom one. This will allow you to have links to custom content types within the same list and not have to worry about the default content type settings.
Comments
Error
The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
but if we use the PageType=6 it's ok.