SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would I go about hiding the ribbon in a task form? I have the form default open in edit mode and don't want the user to be able to see the ribbon at all. Is this possible?

share|improve this question
up vote 6 down vote accepted

If your form is opening in a dialog, you can do it using jQuery:

 $('.ms-dialog #s4-ribbonrow').css('display', 'none');

or just by embedding some CSS on the page:

<style>
.ms-dialog #s4-ribborow {
    display: none;
}
</style>

Or as Danny Engelman pointed out in the comments, if you do not want to load jQuery you can do it with pure Javascript:

<script type="text/javascript">
document.querySelector('#s4-ribbonrow').style.display='none';
</script>
share|improve this answer
    
Or just document.querySelector('#s4-ribbonrow').style.display='none'; if you do not know or want to load jQuery... Note that you can't use SharePoints own mQuery as it is not loaded by default on this form – Danny '365CSI' Engelman Jan 4 at 20:35
    
Thanks guys..would I just insert that anywhere in the editform file? – RJaxx Jan 4 at 20:38
    
Yes, you can insert it in the edit form file using Designer, or you could add a script editor web part to the page and add it that way. Keep in mind, if you are usig one of the Javascript methods, you'll need enclosing <script> tags, and if you are using the CSS way, you need enclosing <style> tags – Dylan Cristy Jan 4 at 20:53
    
Thanks Dylan. I added the following to the end of my file, but was unable to get it to load correctly...am I missing something? <style> .ms-dialog #s4-ribbonrow{ display: none; } – RJaxx Jan 4 at 21:08
    
I would add it high on the page, not at the end. And do you have a closing </style> tag? See my updated answer. – Dylan Cristy Jan 4 at 21:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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