none
Show the Content Type on NewForm.aspx RRS feed

  • Question

  • I realize this may have been asked previously:

    http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/a26d9d91-dce8-4404-8659-cb47feb2287a
    http://social.technet.microsoft.com/Forums/en/sharepointadmin/thread/994ec4dc-f12e-4de5-ba04-1380cf94e542

    But the provided solutions don't really help me.

    I have a custom list with 5 different content types.  When I select  "New -> " and one of the items, it passes a  "ConentTypeID" querystring parameter to the NewForm.aspx.... and the ASPX seems to pick this up because it displays all the columns related to that content type in the particular order I've specified from the Content Type Management screen and includes asteriks next to each required field. However the NewForm.aspx neglects to mention which content type is being used.  In the PlaceHolderPageTitleInTitleArea content area it displays: 

        <SharePoint:ListProperty Property="LinkTitle" runat="server" id="ID_LinkTitle"/>:
        <SharePoint:ListItemProperty id="ID_ItemProperty" MaxLength=40 runat="server"/>

    Which ends up displaying, for all content types, "[List Name]:  New Form". 

    I've tried, from Sharepoint Designer, to Insert a new "Custom List Form" but this was sorely lacking in that (a) while it asks for the Content Type to be used on the form, it doesn't seem to restrict which fields appear on the form (b) it didn't include any of the asteriks for required fields (c) it doesn't do the column ordering right... and... the big one:  Subsequent changes to the column ordering and/or field validation would bring this new "NewForm" out of sync and.... someone would need to update the ASPX form.

     I also, I tried including something like this:    <SharePoint:ListItemProperty id="ListContentType" Property="ContentType" runat="server"/>
    .... but that doesn't return anything ( I imagine this is because the item has not yet been created ). 

    My Question: 

    Is it possible to insert the name of the Content Type in the PlaceHolderPageTitleInTitleArea content area -- using the ContentTypeID as-passed from the querystring?
     
    [ I'm a Site Collection Administrator with Sharepoint Designer. T he servers are kept behind lock & key off site. I cannot use custom code / do not have any access to the sharepoint server or server administration ]
    Tuesday, November 24, 2009 4:03 AM

Answers

  • Here's an idea. 
    1. Create a custom newform.aspx for each content type by simply copying the default one, but DON'T customize the new forms or do anything with the forms.
    2. You can rename them to apprpriately indicate each content type.
    3. On each of these new newforms, above the form part itself, put in a content editor web part or free form text or whatever, and just type the name of that content type right on the page.
    4.  Right click the name of the list in SharePoint Designer, and click <properties> and go to the <supporting files> tab.
    5. choose the drop-down box of the content type, pick your first custom content type, and then <browse> to that content type's associated newform.
    6. Do this for each content type.  This screen is a little finicky, so you may have to hit Apply and Save between each change.

    Now, when someone picks the drop-down box and picks a certain content type to create a new item in the list, they should automatically go to that "custom" form with the name of the content type on it.
    Laura Rogers, MCSE, MCTS
    SharePoint911: SharePoint Consulting
    Blog: http://www.sharepoint911.com/blogs/laura
    Twitter: WonderLaura
    • Marked as answer by tswaters Wednesday, November 25, 2009 1:42 AM
    Tuesday, November 24, 2009 4:55 AM

All replies

  • Here's an idea. 
    1. Create a custom newform.aspx for each content type by simply copying the default one, but DON'T customize the new forms or do anything with the forms.
    2. You can rename them to apprpriately indicate each content type.
    3. On each of these new newforms, above the form part itself, put in a content editor web part or free form text or whatever, and just type the name of that content type right on the page.
    4.  Right click the name of the list in SharePoint Designer, and click <properties> and go to the <supporting files> tab.
    5. choose the drop-down box of the content type, pick your first custom content type, and then <browse> to that content type's associated newform.
    6. Do this for each content type.  This screen is a little finicky, so you may have to hit Apply and Save between each change.

    Now, when someone picks the drop-down box and picks a certain content type to create a new item in the list, they should automatically go to that "custom" form with the name of the content type on it.
    Laura Rogers, MCSE, MCTS
    SharePoint911: SharePoint Consulting
    Blog: http://www.sharepoint911.com/blogs/laura
    Twitter: WonderLaura
    • Marked as answer by tswaters Wednesday, November 25, 2009 1:42 AM
    Tuesday, November 24, 2009 4:55 AM
  •  If you are familar with JavaScript / DHTML you should be able to rig something up:

    1. Add a content editor web part to the page and add JavaScript to the html source
    2. Pull the Content Type ID out of the query string
    3. Make a call to the Lists Web Service:
      http://msdn.microsoft.com/en-us/library/lists.lists.getlistcontenttypes.aspx
    4. Pull the name out of the response (matching on the Content Type ID)
    5. Use DHTML to put the name wherever you want!
    Tuesday, November 24, 2009 5:00 AM
  • hard-coding the names would take, I imagine, 3% of the time it would take me to try and figure out how to actually link into the content type using something like an SPDataSource.  And without custom code such an exercise would be painfully frustrating.  All those with VSTO + access to your server:  You have no idea how good you have it. 

    Anyway... " a little finicky"  might be an understatement.  I'm not able to update the supporting file at all.  I right-click, go to properties & supporting files... click browse & navigate to the new supporting file (this is without changing the drop-down at this point) and press apply.  Go back, and the changes do not take effect.  Ever.  It will always show the last form I created, for each of the content types.  I've tried this a few times and it is not saving.  After pressing apply and trying to change the dropdown, the apply opens up again, pressing it returns the following error:  "Save Conflict.  Your changes conflict with those made concurrently by another user.  If you want your changes to be applied, click Back in your web browser, refresh the page, and resubmit your changes. "....  that's in SPD... is there a back button I'm missing? 

    I can verify I'm the only person with any sort of design access to this site.  

       Any other way to revise these supporting files?  I might just continue down the road of hard-coding and ensure the quick-launch is linking to the appropriate site and completely hide toolbars so the "New [Content type title]" can't be accessed.  I don't like hard-coding things, but sharepoint + SPD isn't making this easy for me.
    Wednesday, November 25, 2009 1:37 AM
  • Ok, scratch that... I went back into the Sharepoint UI and changed around the order of the content types... the apply button seems to be working now

    Thanks!
    Wednesday, November 25, 2009 1:42 AM
  • Hi Laura,

    This is exactly what I need to do, only in Sharepoint 2010. Where do I find the <supporting files> tab?

    Thanks,

    Summer

    Friday, February 8, 2013 12:48 AM