1,668 articles and 12,371 comments as of Wednesday, August 18th, 2010

Tuesday, February 24, 2009

Remove the ‘Save’ button from a SharePoint survey

A major annoyance when setting up a survey in SharePoint is that there is a ‘Save’ button right next to the ‘Next’ button. Huh? Which one should I pick? In the End User’s Mind, your guess is as good as mine… I finish a question, I hit the Save button and I move on to the next question, right? Sorry, EU, that one won’t work here.

Paul has developed a simple solution for removing the Save button from a SharePoint survey. In the screencast below, he blazes through the solution to show you his thought process as he is trying to figure out a solution.

Before we get 256 emails asking “Where is the documentation for this?”, there isn’t any. This is a quick demo to show how it can be done, not a tutorial on how to do it. That’s what the live, online SuperStar! workshops are for.

However, Paul has published an article, Anatomy of a Content Editor Web Part: jQuery and AJAX, that should put you in the ballpark. View the screencast below and let him know what you think.

View all entries in this series: PaulGrenier-CEWPAndjQuery»
Entries in this series:
  1. Anatomy of a Content Editor Web Part: jQuery and AJAX
  2. Remove the 'Save' button from a SharePoint survey
 

Please Join the Discussion

25 Responses to “Remove the ‘Save’ button from a SharePoint survey”
  1. Allyn Easter says:

    Jimminy crickets – now I need some motion sickness medication!

  2. Mick Brown says:

    Nice one Paul, I hung onto your coat-tails there and will be using that one. I’ve been really happy using the scripts you have been doing and I think that its time to get on the bike myself so I wonder if you might have time to do a little piece on how you put your jquery development enviroment together, what tools you use for debugging and any tip/traps you found with that. The jQuery stuff is probably my favorite theme on EUSP at the moment – long may it last

  3. Mark Miller says:

    Mick – We’re actually putting together a workshop to handle just that… setup the environment, walk through the tools and do some simple scripting to get you started. You’ll be one of the first to know. — Mark

  4. Tracy says:

    Paul – thanks so much for sharing!! The PageView and ToolPaneView query parameters tidbit alone was worth it.

    Admittedly, I had to watch this thing about 100 times since this was my first experience with FireBug and JQuery, but eventually everything worked splendidly.

    A quick question for anyone who knows – I tried using just straight JavaScript to achieve the same behavior. Located the ID value for the Save button’s input tag in FireBug and then used the following in the Content Editor Web Part:

    document.getElementById(’elementID’).style.display = ‘none’;

    But no luck – anybody know why the JQuery works, but JavaScript didn’t?

    Thanks again!
    -Tracy

  5. AutoSponge says:

    @Tracy

    That usually doesn’t work because SP has a lock on the onLoad event. There is a built in function for running your code:

    
    
  6. Josh says:

    Would you mind posting the jQuery code you showed in the video?

    It was difficult to see some of the text due to pixelation, so if you could just post what you copied and pasted into the content editor source editor (the webpart you titled HideSaveButton) that would be great!

    Thank you!

  7. AutoSponge says:

    @josh

    If you start with the template I showed in my other article (link above), all you need is:

    $(”:inputs[value='Save']“).hide();

  8. mindliner says:

    Is there a way to hide the first set of buttons (next/save/cancel) so that it only shows the 2nd set?

    It often ends up looking redundant to have the Next/Save/Cancel buttons showing up before and after a short form, so it would be great if I could display only the buttons at the end of each form page.

  9. AutoSponge says:

    @mindliner,

    Try this: $(”table.ms-formtoolbar tr:first”).hide()

  10. Chris says:

    Thanks for the information! It was a great help to me…

  11. Sharpey says:

    Any ideas why, as an administrator, I am unable to see user’s incomplete surveys? I am a site administrator, and although the overview is recognising 33 responses, in the All Responses view, only the complete ones are showing (and my incomplete surveys).

  12. Sian Doherty says:

    I am having the same issue as Sharpey shared on July 3rd and was wondering if anyone had any ideas on how to find incomplete surveys?
    Thanks

  13. Bryon Lape says:

    I was able to get this to work under SharePoint, but not under Firebug. What version is used in the video?

  14. Rod says:

    I am trying to use tabs in place of the next button for a survey. Can you give me an idea of what code the next button is running for i can add it to the tabs?

  15. sirisha says:

    Hi,

    I want to add a button to the survey page and on click of the button the page has to be saved to drafts in a library.

    Is the requirement possible?Please help.

    Regards,
    Sirisha.

  16. Michael W. says:

    I echo Sharpey’s comments. The All Responses really only means completed responses, plus your own incomplete responses, but does not show incomplete results from other submitters. It would be nice to be able to see all incomplete responses for follow up purposes, but looks like Paul’s option to remove the Save button is the best available for now.

  17. Dmitry says:

    Didn’t work for me in MOSS 2007 and IE 8. What did I do wrong? It looks like the code is never executed.

  18. Jatin says:

    I have below issue and comment and question
    1) I have tried with google JQuery and it works only if I put TWO content Editor Webpart

    2) I downloaded JQuery from google and put it in my SharedDoucment Library , created new library “Javascripts” and I putted exactly the same syntax you show in video ‘/Javascripts’ , and it now my JQuery does not work, It does not hide “Save” button. an idea why?

    3) I have found that above work can be done by below simple JavaScript rather using JQuery

    document.getElementById’sdfsdf_……….._dfdfdF_dfdfdfctl00_diidIOSaveItem’).style.display=”none”;

    you just need to find ID of Save Button in ‘View SOurce’ of that webpage.

  19. Hassan says:

    This tutorial is great because it’s exactly what I was looking for. Unfortunately, I’ve been unable to get this to work for me. I downloaded jQuery and saved it to a javascripts document library and this is the code that I’ve got in my content editor web part. I can’t figure out what I’m doing wrong.

    if(typeof jQuery==’undefined’) {
    var jQPath = ‘/javascripts/’;
    document.write(”);
    }

    //?PageView=Shared&ToolPaneView=2

    $(function() {
    $(”;inputs[value='Save']“).hide();
    ));

  20. Ahwin says:

    Great article :)
    I just followed the steps in the video and it works on my survey that uses page separator and branching…

    this helps a lot…

    Many thanks for the great post…

  21. Nadia says:

    Man you are absolutely awesome! I’m not a developer but mere super user and was able to follow your instructions.

    Now all that I have left is to try and recover those incomplete surveys which I still can’t see. Any thoughts!? Thanks a million for your help!!!

  22. Surya Padala says:

    If you dont want to use Jquery then copy the following code into Content Editor WebPart(CEWP) on NewForm and EditFrom.

    _spBodyOnLoadFunctionNames.push(”setValue”);

    function setValue()
    {
    hideButton(”Save”);
    }

    //This function hides a button on the page
    function hideButton(valueDef)
    {
    var frm = document.forms[0];
    for (i=0;i< frm.elements.length;i++)
    {
    if (frm.elements[i].type == "button" && frm.elements[i].value == valueDef)
    {
    frm.elements[i].style.display = "none";
    }
    }}

    Thanks.

  23. Surya Padala says:

    It should be inside JavaScript tag

    _spBodyOnLoadFunctionNames.push(”setValue”);

    function setValue() {
    hideButton(”Save”);
    }

    //This function hides a button on the page
    function hideButton(valueDef)
    {
    var frm = document.forms[0];
    for (i=0;i< frm.elements.length;i++)
    {
    if (frm.elements[i].type == "button" && frm.elements[i].value == valueDef)
    {
    frm.elements[i].style.display = "none";
    }
    }}

Trackbacks

Check out what others are saying about this post...
  1. [...] is the link to the workaround: http://www.endusersharepoint.com/?p=1371 Tagged with: Page Separator, Sharepoint Survey « Users with lower permission level [...]

  2. [...] is the link to the workaround: http://www.endusersharepoint.com/?p=1371 Tagged with: Page Separator, Sharepoint Survey « Users with lower permission level [...]




Notify me of comments to this article:


Speak and you will be heard.

We check comments hourly.
If you want a pic to show with your comment, go get a gravatar!