locked
NewForm always creates default content type RRS feed

  • Question

  • Hi,

    I have a list with three content types. In Sharepoint Designer I have created some custom forms by copying the NewForm.aspx. Thereafter I have inserted a custom list form in each form, where I choose which list and which content type which should be used. 

     

    However, when creating new items in the list with either of these forms, the items are always created as the default content type. 

     

    However, if I set a form as default unde Supporting Files in the list properties in Designer, and create a new item by clicking New.. on the list and choosing the correct content type, the item gets the correct content type. But still, if linking directly to a form that is not set as default for the content type, Sharepoint disregards that this form is supposed to be specific to a certain content type and instead just creates the item as the default content type.

    Monday, May 30, 2011 2:31 PM

Answers

  • So I solved this myself. When linking directly to a NewForm, you must add 

    ?ContentTypeId=0x010811A1B0C3872F5A0449A49199B8D5808E7600C05A23897C36964AB7EC991A719E8EF3

    to the URL. Of course insert your own content type ID (you can find it if you open a newform for this content type via the "New"-button in the list.

     

    The URl can for example be:

    http://intranet/Lists/MyList/MyNewForm.aspx?ContentTypeId=0x010811A1B0C3872F5A0449A49199B8D5808E7600C05A23897C36964AB7EC991A719E8EF3

    • Marked as answer by audunms Monday, June 6, 2011 8:34 AM
    Monday, June 6, 2011 8:34 AM

All replies

  • Hi  audunms,

    I understand that you have added 3 content types to a list and wanted to associate 3 content type items (in New) with 3 custom new forms, but you clicked each item then it jumped to the default form page (default content type), not your custom new form pages. If it was, it seems to be some sittings wrong for each content type in Designer.

    I suggest that you check the settings for each content type item under “Supporting Files” with SharePoint Designer, and associate the correct custom form page (“New item form” ) to the correct content type (“Content type specific forms” dropdown list).


    Thanks & Regards,
    Daniel

    Wednesday, June 1, 2011 9:24 AM
    Moderator
  • Thanks for your reply. You have understood me correctly. The correct content type is used if the corresponding form is set as default under supporting files.

     

    The problem, however, is that if I _don't_ set the form as default under Supporting Files (I access the form via the URL directly), then the item created is always the default content type.

     

    When you create a new custom form, you choose which content type this form is associated with. The problem seems to be that this choice is disregarded unless you also specify the form as default under SUpporting Files (I have two forms for each content type)

    Wednesday, June 1, 2011 11:11 AM
  • The problem, however, is that if I _don't_ set the form as default under Supporting Files (I access the form via the URL directly), then the item created is always the default content type.


    Could you tell me how did you access the form via the URL directly?

    And I understand as follow, 

    1. You associated 3 content types to a list named listA (e.g. item1, item2, item3 in New).
    2. You created 3 custom new forms (e.g. form1,form2, form3  .aspx).
    3. You located to listA with SharePoint Designer, under Supporting Files, you selected "item1" from “Content type specific forms”, and selected "form1" from “New item form”, and also set as "item2 -> form2",  "item3 -> form3".
    4. Then when you selected item1 from New in the listA, it should jump to form1. Selected item2 then jumped to form2, selected item3 then jumped to form3.

    I tested as above steps and it worked as expected. If I misunderstood, please correct me.

    Thanks & Regards,

    Daniel

    Thursday, June 2, 2011 12:18 PM
    Moderator
  • Hi, to access the form I type the address to the form in my browser, for example:

    http://sharepoint.com/Lists/MyList/MyNewForm.aspx

     

    I can explain the steps here (I use two content types here for simplicity)

    1. Create two content types.

    2. Associate the two content types with a List (MyList)

    3. Create two new list forms (NewFormA.aspx and NewFormB.aspx) in Sharepoint Designer
    (Copy existing NewForm.aspx, remove default form from page, Insert - Sharepoint Controls - Custom List Form, choose correct list under "List or document library to use for form", choose respective content type under "Content type to use for form" and choose New item form under "Type of form to create")

    4. Set the two forms as Content Type Specific Forms for their respective content types under Supporting Files for the list in Sharepoint Designer

    5. Create another two lists forms (NewFormC.aspx and NewFormD.aspx), using the same method as in 3)

    6. Now, NewFormA.aspx and NewFormB.aspx creates new items with correct content type. However, NewFormC.aspx and NewFormD.aspx only creates new items with default content type. 

     

    Thanks again,

    Thursday, June 2, 2011 1:18 PM
  • So I solved this myself. When linking directly to a NewForm, you must add 

    ?ContentTypeId=0x010811A1B0C3872F5A0449A49199B8D5808E7600C05A23897C36964AB7EC991A719E8EF3

    to the URL. Of course insert your own content type ID (you can find it if you open a newform for this content type via the "New"-button in the list.

     

    The URl can for example be:

    http://intranet/Lists/MyList/MyNewForm.aspx?ContentTypeId=0x010811A1B0C3872F5A0449A49199B8D5808E7600C05A23897C36964AB7EC991A719E8EF3

    • Marked as answer by audunms Monday, June 6, 2011 8:34 AM
    Monday, June 6, 2011 8:34 AM