12

I am using SharePoint 2013 and I have a custom contentype inherited from task. Because there are too many fields, by default there is a Show More option to show all the fields.

Is there a way to show all fields by default and get rid of the Show More option?

4 Answers 4

12

Tasks new and edit forms, use JavaScript code that embed inside these form to show unrequired controls.

When click the “Show more” button, this will fire rlfiShowMore JavaScript function. Then if you want do disable this functionality, you can call this function after page loaded:

 <script>
    (function () {
        _spBodyOnLoadFunctionNames.push("rlfiShowMore");
    })();
</script>
7

There's a simple No code solution there. Just change the order of the columns in the content type. Task Status should come before Priority for e.g. If Priority is at 8 and Task Status is at 9, just switch the column order value so in the end it would be Priority at 9 and Task status at 8.

1
  • See option 5 in my answer
    – pholpar
    Jun 11, 2015 at 7:39
2

Yet another approach that demonstrates how to customize task forms in order to display fields without 'Show more' option

  • Create rendering template to display all the fields in New & Edit forms
  • Update Task web part in New & Edit forms pages

Template file

The following example demonstrates how to display all the fields of Task form:

(function () {


    function preTaskFormRenderer(renderCtx) {
       rlfiShowMore();
    }


    function registerRenderer()
    {
      var ctxForm = {};
      ctxForm.Templates = {};
      ctxForm.OnPreRender = preTaskFormRenderer;

      SPClientTemplates.TemplateManager.RegisterTemplateOverrides(ctxForm);
    } 
    ExecuteOrDelayUntilScriptLoaded(registerRenderer, 'clienttemplates.js');

})();

How to apply changes

  1. Upload the specified script (lets name it TaskForm.js) into SharePoint Site Assets library
  2. Open New Form page in edit mode and go to Tasks web part properties
  3. Specify JS Link property located under Miscellaneous group: ~sitecollection/SiteAssets/TaskForm.js (see pic. 1)
  4. Save changes and repeat steps 2-4 for Edit form

enter image description here

0

I prefer other methods to the JavaScript workaround to really solve the problem: 1. You can change the list form assigned to the local Task content type, for example via PowerShell:

$web = Get-SPWeb http://YourSharePointSite 
$list = $web.Lists["Tasks"] 
$ct = $list.ContentTypes[0] 
$ct.DisplayFormTemplateName = "ListForm" 
$ct.NewFormTemplateName = "ListForm" 
$ct.EditFormTemplateName = "ListForm" 
$ct.Update()
  1. You can set the list form assigned to the ListFormWebPart via SharePoint Designer
  2. Create your own control template and add the ShowExpanded="true" attribute to the TaskListFieldIterator control
  3. Pass the Expanded=1 in the request query string like NewForm.aspx?Expanded=1
  4. Change the default column order of the local Task content type

All of these have the effect of displaying all the fields without the "Show More" button. You can read more about these methods here: http://pholpar.wordpress.com/2014/11/01/no-more-show-more-in-tasks-lists/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.