1

I have the following lines (using javascript) in my default display form associated with a document library. It works fine, but when I go to add another web part to that display form, it overrides it and the new web part is missing. Thoughts?

document.querySelector('#s4-ribbonrow').style.display='none';

Ultimately, I would like to hide the ribbon row AND display more than one web part in the default form.

5
  • How are you adding the JS to the form? Feb 17, 2016 at 6:57
  • I just have it in the display form file in designer.
    – RJaxx
    Feb 17, 2016 at 15:11
  • And how are you adding the new webpart? Through designer? Feb 17, 2016 at 16:57
  • No.. I was going through the default display form in SP and just hitting 'Add a Web Part'.
    – RJaxx
    Feb 17, 2016 at 19:25
  • Hi there, did you fix this problem yet? Feb 27, 2016 at 12:30

1 Answer 1

0

To hide the ribbon from a specific form you can use a content editor webpart.

Put the Javascript in a script block in a .html file and put the address to that file in the source part of the content editor webpart.

Hide the content editor webpart itself using the webpart settings.

You should be able to add more webparts to the same form.

You can reuse the .html file this same way anytime you want to hide the ribbon from a form.

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.