locked
Loading NewForm based on Content Type RRS feed

  • Question

  • I am using the Training Fab 40 template to build a training site in MOSS 2007. I have another content type for my Course list. I want to load the NewForm.aspx based on Content Type selected. The two content types are "Classroom Training" and "Offline Training". Although the NewForm should automatically get modified based on content type, but since I have modified the NewForm.aspx, it is not loading. I even tried to change the forms from SharePoint Designer via List properties, but in-vain.

    Is there a way I can redirect to separate forms via JavaScript or anything else?
    Monday, December 31, 2012 9:59 AM

Answers

  • Hi,

    I understand that you want to create different forms for each content type. If you set the new form for each content type correctly, you won’t need any javascript to load the new forms. Since there are two content types, you can create two new forms.

    1. Open the site in SharePoint designer.
    2. Open the list. Make two copies of the NewForm.aspx page. Modify the two copies according to your requirement.
    3. Right click on the List name and choose Properties.
    4. Under Supporting Files, change the New item form to each content type to the new form URL. Save the changes and preview in browser.

    Thanks,

    Entan Ming

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contacttnmff@microsoft.com.


    Entan Ming
    TechNet Community Support

    Tuesday, January 1, 2013 1:42 AM
    Moderator

All replies

  • Hi,

    I understand that you want to create different forms for each content type. If you set the new form for each content type correctly, you won’t need any javascript to load the new forms. Since there are two content types, you can create two new forms.

    1. Open the site in SharePoint designer.
    2. Open the list. Make two copies of the NewForm.aspx page. Modify the two copies according to your requirement.
    3. Right click on the List name and choose Properties.
    4. Under Supporting Files, change the New item form to each content type to the new form URL. Save the changes and preview in browser.

    Thanks,

    Entan Ming

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contacttnmff@microsoft.com.


    Entan Ming
    TechNet Community Support

    Tuesday, January 1, 2013 1:42 AM
    Moderator
  • Entang,

    Thanks for your reply. These were the exact steps I tried, but the list loaded only NewForm.aspx. In one of the post I read that you should copy the NewForm.aspx to two new forms and modify those without modifying the original NewForm.aspx. However, in my case the original NewForm.aspx was already modified in the site template. 

    Any way I can still use that modified NewForm.aspx to create two new forms based on Content Type?

    Thanks again for your reply.

    Tuesday, January 1, 2013 5:44 AM
  • Hi,

    Since you have modified the NewForm.aspx page, you can create a new aspx page instead. Click Insert>SharePoint Controls>List Form. Then select the list. It will act the same way as the NewForm.aspx page. Or you can use the Custom List form web. This will allow you to edit the columns and formatting.

    After setting Supporting Files under the List Properties, you need to double check whether SharePoint has saved the changes. Sometimes you need to select the New item form multiple time before it can be saved.

    Thanks,

    Entan Ming

    TechNet Subscriber Support in forum

    If you have any feedback on our support, please contacttnmff@microsoft.com.


    Entan Ming
    TechNet Community Support

    Tuesday, January 1, 2013 8:01 AM
    Moderator
  • Entang,

    Highly appreciate your response. However, don't know why the supporting files tab has not been able to update the files and the New link always renders NewForm.aspx. As per your suggestion, i tried to save the files many times, but still the same. The supporting files tab still shows modified pages, but while rendering it renders NewForm in all cases.

    Any workaround would be helpful. Or else I may have to live rest of my life with the same functionality.

    Tuesday, January 1, 2013 2:28 PM
  • Hi,

    Please try the steps below:

    1. Open  the site in SharePoint designer. Make a copy of a NewForm.aspx page which haven’t been modified(you can get one by creating a new list).
    2. Then paste this NewForm-copy1.aspx page under your Course  list .
    3. Edit this page. Find the ListId and ListName properties in the list form web part. Then change them to your Course list GUID. This GUID can be get by clicking List settings in browser.
    4. Then the NewForm-copy1.aspx  page will show the new form web part for the Course list.
    5. Make a copy of the existing NewForm.aspx page of the Course list and delete it from the list folder.
    6. Rename the NewForm-copy1.aspx to NewForm.aspx. Preview it in browser to see whether it works.
    7. Then you can create two more new item forms based on this NewForm.aspx page. Don’t modify it directly any more.
    8. Modify the list property to use the new item forms for each content type.

    If this doesn’t work, you will have to create another list instead.

    Thanks,

    Entan Ming


    Entan Ming
    TechNet Community Support

    Wednesday, January 2, 2013 10:06 AM
    Moderator