none
hiding the content type from the edit form and view form RRS feed

  • Question

  • hi,

    i have two content type in my document Library. so when i click on the edit item button it is showing a drop down to select any of the content type.

    how can i set a default content type for edit form, so that the drop down never comes there in the form.

    Friday, April 5, 2013 5:17 AM

Answers

  • Hello,

    We can do this with the help of JavaScript. On Edit form we can add Content Editor web part and add java script in it.

    Using JavaScript we can set the selected value in drop down and can hide also.

    I hope this idea will help you!


    Thanks!
    BR, Prasham
    http://prashamsabadra.blogspot.in/

    Friday, April 5, 2013 6:06 AM
  • You can hide the content type column by Sharepoint Designer. Just open you list, create a new form for edit and view (make them as default forms). Open the form, and remove the row of content type, and then save it.

    And to set the default content type, go to library settings. If you are having multiple content type, then under Content Types click on the link "Change new button order and default content type". Here set you default content type at the first position, and click on OK.

    Then try to open you list item in edit or view, you will not see the content type column there.

    Friday, April 5, 2013 6:51 AM
  • add a content editor webpart in the edit form. add the following javascript in it.

    function findacontrol(FieldName) 
    {
       var arr = document.getElementsByTagName("!");   
       for (var i=0;i < arr.length; i++ )
       { 
              if (arr[i].innerHTML.indexOf(FieldName) > 0)

          {       
            return arr[i];  
          }
       }
    }
          
    function hideFields() 
    {
      control = findacontrol("Content Type");
      control.parentNode.parentNode.style.display="none";

    }

    Friday, April 5, 2013 7:23 AM

All replies

  • Hello,

    We can do this with the help of JavaScript. On Edit form we can add Content Editor web part and add java script in it.

    Using JavaScript we can set the selected value in drop down and can hide also.

    I hope this idea will help you!


    Thanks!
    BR, Prasham
    http://prashamsabadra.blogspot.in/

    Friday, April 5, 2013 6:06 AM
  • You can hide the content type column by Sharepoint Designer. Just open you list, create a new form for edit and view (make them as default forms). Open the form, and remove the row of content type, and then save it.

    And to set the default content type, go to library settings. If you are having multiple content type, then under Content Types click on the link "Change new button order and default content type". Here set you default content type at the first position, and click on OK.

    Then try to open you list item in edit or view, you will not see the content type column there.

    Friday, April 5, 2013 6:51 AM
  • add a content editor webpart in the edit form. add the following javascript in it.

    function findacontrol(FieldName) 
    {
       var arr = document.getElementsByTagName("!");   
       for (var i=0;i < arr.length; i++ )
       { 
              if (arr[i].innerHTML.indexOf(FieldName) > 0)

          {       
            return arr[i];  
          }
       }
    }
          
    function hideFields() 
    {
      control = findacontrol("Content Type");
      control.parentNode.parentNode.style.display="none";

    }

    Friday, April 5, 2013 7:23 AM
  • I'm assuming that you wanted to add the <script></script> tags around this. However, I'm not sure about whether this is the exact syntax since I couldn't get it to work. Would you mind posting the complete solution?

    Thursday, January 16, 2014 9:01 PM
  • You can use the below JS script in Content Editor or Script Editor Web Part

    $(function() {
    //  Hide content type column in edit form
      $("select[title='Content Type']").closest('tr').hide(); 
    });

    For the detail steps check Hide Content Type Column In Edit Form In SharePoint

    Monday, February 4, 2019 12:12 AM